手工处理方法:
1、登陆tiptop账号
2、运行命令:ps -ef|grep as.xcf_84 ,找出xcf对应着httpdispatch的进程id
3、把进程删掉:kill 进程id
4、重启进程命令:startws
因此,可以写成自动脚本(比如命名:restartws.sh)
#!/bin/ksh
# 设置当前目录路径
DIR="/u1/topprod/tiptop"
cd $DIR || exit 1
# 日志记录位置
LOG_FILE="$DIR/restart_service.log"
. /u1/usr/profile/profile.topprod
# 1. 查找进程PID
PID=$(ps -ef | grep 'as.xcf_84' | grep 'httpdispatch' | grep -v grep | awk '{print $2}')
# 2. 杀死进程(如果存在)
if [ -n "$PID" ]; then
echo "[$(date)] 找到进程 PID: $PID, 执行 kill"
kill -9 "$PID"
sleep 2 # 给进程终止留出时间
else
echo "[$(date)] 未找到运行中的进程"
fi
sleep 5
# 3. 重启服务
echo "[$(date)] 正在重启服务..."
echo "restartws"
startws
echo "[$(date)] 服务已重启"
echo "" >> $LOG_FILE # 添加空行分隔日志
无论是方便一条命令处理:
sh restartws.sh
还是执行定时自动重启都可以用。自己编写Crontab,记得要以tiptop 的角色来操作
转载请注明:赫非域 » 自动重启WebServer接口脚本