Files
xkm-server/battle_server_999/runenv/stop_battle_all.sh
2025-05-21 13:43:08 +08:00

44 lines
956 B
Bash
Executable File

#!/bin/sh
#date:2018090816
#禁止以root用户运行
curuser=`whoami`
if [ $curuser = "root1" ];then
echo "root Operation is not allowed!!"
exit -1
fi
#定义停止进程函数
function stop_all_svr(){
cd /data/home/mmog/battle_server_999/runenv/battle_svr/cfg
./stop_battle_svr.sh
}
#统计进程总数
search_keys="battle_svr_10_999_ag"
proc_count=`ps -ef|egrep "${search_keys}"|grep -v grep |wc -l`
#停止进程
if [ ${proc_count} -eq 0 ];then
echo "-------- a5game_zs_999 --------"
echo "未找到正在运行的进程,退出程序"
echo "------------------------------"
exit 0
else
echo "-------- 开始停止进程 ---------"
stop_all_svr
sleep 2
fi
#检查进程状态
cd /data/home/mmog/battle_server_999/runenv/
if [ ! -f ./check_battle_all.sh ];then
echo "检查脚本check_battle_all.sh不存在"
exit 0
else
echo "-------- 打印停止结果 ---------"
sh ./check_battle_all.sh
fi