#! /bin/bash
# author:wangqd
PROC_NAME_1="GameServerClusterR"
PROC_NAME_2="grserver"
LOG_FILE=/var/log/GM.log
CHECK_TIME=$(date +"%Y-%m-%d %H:%M:%S %Y")
PROC_OUT=‘/opt/scripts/cron/.centos-rsync-lock‘
#check
if [ -f $PROC_OUT ]; then
echo "进程为正常关闭"
exit 0
fi
#GameServerClusterR
PROC_NAME1()
{
num1=$(ps -ef|grep $PROC_NAME_1 |grep -v grep | wc -l)
}
PROC_NAME1
if [ $num1 -eq 0 ];then
echo "ERROR,$PROC_NAME_1 stop,time $CHECK_TIME" >> $LOG_FILE
cd /data/S1_GameServer/cluster/
./GameServerClusterR -d
echo "GameServerClusterR进程启动成功!"
else
echo "GameServerClusterR 正在运行"
fi
#grserver
PROC_NAME2()
{
num2=$(ps -ef|grep $PROC_NAME_2 |grep -v grep | wc -l)
}
PROC_NAME2
if [ $num2 -eq 0 ];then
echo "ERROR,$PROC_NAME_2 stop,time $CHECK_TIME" >> $LOG_FILE
cd /data/S1_GameServer/server
./grserver -d
echo "Grserver进程已关闭,启动成功"
else
echo "Grserver进程 正在运行"
fi