Files
chuanqi-server/server/build/RobotGate/stop.sh
aixianling 06658f112f init
2024-12-13 13:41:02 +08:00

32 lines
846 B
Bash

#!/bin/bash
cd $(cd "$(dirname "$0")" && pwd)
path=`pwd`
datetime=`date "+%Y-%m-%d.%H:%M:%S"`
curdoc=$(pwd|awk -F \/ '{print $NF}')
#关闭基础服务
arr_srv="robootgate"
for srv in ${arr_srv[@]};
do
pid=`ps aux |grep $path|grep $srv|grep -v grep|grep "\<$curdoc\>"|grep -v "/bin/bash"|awk '{print $2}'`
if [[ -n $pid ]]; then
echo "开始结束服务器: $srv (pid=$pid)"
kill -15 $pid
while true; do
datetime=`date "+%Y-%m-%d.%H:%M:%S"`
proc=`ps aux |grep $path|grep $srv|grep -v grep|grep "\<$curdoc\>"|grep -v "/bin/bash"|wc -l`
if [ $proc == 0 ];
then
break
fi
echo $datetime" 游戏服务 "$path" "$srv" 结束中..."
sleep 1
done
echo "已结束服务器: $srv"
fi
done
exit 0