HomeServer/killall.sh
2024-11-20 15:41:37 +08:00

30 lines
867 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
PROJECT_PATH=$(cd `dirname $0`;pwd)
appName="homeMaJia1" #App名
centerUrl="http://192.168.50.111:8000/ServerManage" #内网管理地址
if [ -z $1 ] || [ -z $2 ]
then
echo "输入正确的游戏服ID"
else
ps -ef | grep home
echo ""
for i in $(seq $1 $2)
do
pid=$(ps aux | grep -w "$appName Server/Config/config_$i" | grep -v "grep" | awk '{print $2}')
if [ "" = "$pid" ] || [ ! "$pid" ]
then
echo "未找到程序" $appName 进程 "集群ID" $i
else
echo "向中心服注销" $appName "集群ID" $i 进程ID $pid
curl -m 500 -X POST -H "Content-Type: application/json" -d '{"cmd":888,"serverId":'$i'}' $centerUrl #500秒超时正常无人的游戏服会秒回
echo "关闭程序" $appName "集群ID" $i 进程ID $pid
echo ""
kill -s 12 $pid
fi
sleep 3s
done
echo "服务器相关进程全部关闭"
fi