generated from root/miduo_server
50 lines
1.6 KiB
Bash
50 lines
1.6 KiB
Bash
|
#!/bin/bash
|
||
|
#set 200 81.71.33.247 20002 "core2"
|
||
|
gameip=$1 #游戏服ip
|
||
|
serverid=$2 #游戏服id
|
||
|
proccessname=$3 #core1
|
||
|
echo $gameip $serverid $proccessname
|
||
|
|
||
|
##这里是所有的动态参数,根据游戏服做修改
|
||
|
mongourl=$4
|
||
|
redisIp=$5
|
||
|
redisPwd=$6
|
||
|
|
||
|
#停游戏进程
|
||
|
ansible $gameip -m shell -a "supervisorctl stop $proccessname"
|
||
|
|
||
|
#删mongo数据
|
||
|
tempFile="clearMongo.js"
|
||
|
|
||
|
#if [ ! -f "$tempFile" ]; then
|
||
|
# touch $tempFile
|
||
|
# echo "print('========= 进入mongo脚本 mongoDB... ==========');" >> $tempFile
|
||
|
# echo "if (db.getCollection('user').count()<50){" >> $tempFile
|
||
|
# echo "db.getCollection('user').drop();" >> $tempFile
|
||
|
# echo "db.getCollection('globalSystemControl').drop();" >> $tempFile
|
||
|
# echo "db.getCollection('itemLog').drop();" >> $tempFile
|
||
|
# echo "db.getCollection('mailingSystem').drop(); " >> $tempFile
|
||
|
# echo "db.getCollection('server_config').drop();" >> $tempFile
|
||
|
# echo "db.getCollection('guildInfo').drop();" >> $tempFile
|
||
|
# echo "db.getCollection('guildLog').drop(); " >> $tempFile
|
||
|
# echo "print('========= mongoDB脚本删除成功... ==========');}" >> $tempFile
|
||
|
#fi
|
||
|
|
||
|
mongo "mongodb://"$mongourl"/jieling_"$serverid"?authSource=admin" $tempFile
|
||
|
|
||
|
#删除redis数据
|
||
|
num=$(redis-cli -h $redisIp -a $redisPwd keys $serverid"*"|wc -l)
|
||
|
echo "redis数量"$num
|
||
|
if [ $num -lt 500 ]
|
||
|
then
|
||
|
redis-cli -h $redisIp -a $redisPwd keys $serverid"*" | xargs redis-cli -h $redisIp -a $redisPwd del
|
||
|
echo "deleting redis data"
|
||
|
else
|
||
|
echo "too many users,can not delete success"
|
||
|
fi
|
||
|
|
||
|
#起游戏进程
|
||
|
ansible $gameip -m shell -a "supervisorctl start $proccessname"
|
||
|
#ansible 129.226.193.174 -m shell -a "/data/jieling/bin/start-all.sh core1"
|
||
|
|