44 lines
973 B
Bash
Executable File
44 lines
973 B
Bash
Executable File
#!/bin/bash
|
|
|
|
curuser=`whoami`
|
|
if [ $curuser = "root1" ];then
|
|
echo "root Operation is not allowed!!"
|
|
exit -1
|
|
fi
|
|
|
|
# 系统环境变量
|
|
export PATH=$PATH:/usr/local/bin/
|
|
|
|
# PID文件
|
|
moderation_pid="moderation_svr_10_999_ag.pid"
|
|
|
|
# 调用停止脚本
|
|
sh stop_moderation_svr.sh >>/dev/null
|
|
|
|
# 循环等待停止
|
|
for i in {1..30};
|
|
do
|
|
result=$(ps -ef|grep ${moderation_pid} |grep -v grep|wc -l)
|
|
if [ "${result}" == "1" ];then
|
|
sleep 1
|
|
else
|
|
break;
|
|
fi
|
|
done
|
|
|
|
# 如果30秒后还存在则强制KILL进程
|
|
result=$(ps -ef|grep ${moderation_pid} |grep -v grep|wc -l)
|
|
if [ "${result}" == "1" ];then
|
|
kill -9 $(ps -ef|grep ${moderation_pid} |grep -v grep|awk '{print $2}')
|
|
rm -f ${moderation_pid}
|
|
fi
|
|
|
|
# 启动进程
|
|
if [ -f "../bin/moderation_svr" ];then
|
|
chmod +x ../bin/moderation_svr
|
|
../bin/moderation_svr --pid-file=${moderation_pid} --conf-file=config.toml >>/dev/null
|
|
else
|
|
echo "启动失败,未找到moderation_svr程序..."
|
|
fi
|
|
|