#!/bin/sh #date:20191219 #禁止以root用户运行 curuser=`whoami` if [ $curuser = "root1" ];then echo "root Operation is not allowed!!" exit -1 fi #添加全局变量 export PATH=$PATH:/data/home/mmog/center_relay_900_1/tools/ #定义停止进程函数 function stop_all_svr(){ cd /data/home/mmog/center_relay_900_1/runenv/ cd ./relay_svr/cfg/ ./stop_relay_svr.sh cd ../../busd/cfg/ ./stop_busd.sh } #统计进程总数 proc_count=`ps -ef|grep 'agame_zs_900\>'|grep -v grep|egrep 'center_relay_10_900_1_ag|relay_busd_svr_10_900_1_ag' |wc -l` #停止进程 if [ ${proc_count} -eq 0 ];then echo "-------- agame_zs_900 --------" echo "未找到正在运行的进程,退出程序" echo "------------------------------" exit 0 else echo "-------- 开始停止进程 ---------" stop_all_svr sleep 2 fi #检查进程状态 cd /data/home/mmog/center_relay_900_1/runenv/ if [ ! -f ./check_relay_all.sh ];then echo "检查脚本check_relay_all.sh不存在" exit 0 else echo "-------- 打印启动结果 --------" sh ./check_relay_all.sh fi