You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

175 lines
4.4 KiB

#!/bin/bash
set -x
BIN_DIR=../bin
ACCOUNTSVR_ID=10
DBSVR_ID=11
ACCOUNTGATE_ID=13
HTTPPROXY_ID=14
VERSIONSVR_ID=15
VERSIONGATE_ID=16
REALMLIST_ID=17
NAME_ID=19
HTTPPROXY_PAY_ID=22
ACCOUNT_BILLLOG_ID=23
OPERATIONSVR_ID=24
PLAYEROPSVR_ID=25
FRAMESYNC_ID=26
FRAMESYNCGATE_ID=27
GAMESVR_ID=200
GAMEGATE_ID=201
WORLDSVR_ID=202
GAMEDB_ID=203
BATTLE_ID=204
HTTPPROXYWORLD_ID=206
CHAT_ID=207
CHATGATE_ID=208
RANK_ID=209
BILLLOG_ID=210
INSTANCESVR_ID=213
UNIONSVR_ID=214
ARENASVR_ID=215
FRIEND_ID=216
MAILSVR_ID=218
RACEHORSESVR_ID=219
TRADESVR_ID=220
WORLD_ID=1
GAMEGATE_COUNT=2
GAME_COUNT=2
BATTLE_COUNT=2
FRAMESYNC_COUNT=1
FRIEND_COUNT=2
RACEHOR_COUNT=1
CLUSTER_INST_ID=1
if [ $HOSTNAME = "yuan-vm" ] ; then
CLUSTER_INST_ID=2
fi
HOST_L5="${HOSTNAME:0:5}"
RLS_AREA=0
if [ ${HOST_L5} = "pdrjp" ] ; then
RLS_AREA=1
BATTLE_COUNT=5
GAMEGATE_COUNT=5
GAME_COUNT=5
elif [ ${HOST_L5} = "pdrkr" ] ; then
RLS_AREA=2
BATTLE_COUNT=5
GAMEGATE_COUNT=5
GAME_COUNT=5
elif [ ${HOST_L5} = "anhei" ] ; then
RLS_AREA=3
BATTLE_COUNT=0
GAMEGATE_COUNT=5
GAME_COUNT=5
elif [ ${HOST_L5} = "pdren" ] ; then
RLS_AREA=4
BATTLE_COUNT=5
GAMEGATE_COUNT=5
GAME_COUNT=5
elif [ ${HOST_L5} = "huoli" ] ; then
RLS_AREA=5
BATTLE_COUNT=0
GAMEGATE_COUNT=5
GAME_COUNT=5
fi
#正式环境从cluster.json自动解析worldid
auto_parse_worldid()
{
WORLD_ID=`grep -A 1 $HOSTNAME\" $CFG_PATH/cluster.json | grep worldid | awk -F "[{,:}]" '{for(i=1;i<=NF;i++){if($i~"'worldid'"){print $(i+1)}}}' | sed 's/^[ \t]*//g' | sed 's/,//'`
echo $WORLD_ID
}
CFG_PATH=../cfg
# 不同机器环境判断
if [ $HOSTNAME = "pandora_dev1" ] || [ $HOSTNAME = "pandora-se-test-2" ]; then
CFG_PATH=${CFG_PATH}/pandora_test
elif [ $HOSTNAME = "anhei-audit" ] || [ $HOSTNAME = "anhei-test" ] || [ $HOSTNAME = "anhei-app-test" ] || [ $HOSTNAME = "huoli-mirror-full-full001" ] || [ $HOSTNAME = "huoli-world-802" ]; then
CFG_PATH=${CFG_PATH}/pandora_test_mysql
if [ $HOSTNAME = "huoli-mirror-full-full001" ]; then
auto_parse_worldid
fi
elif [ $HOSTNAME = "pandora-se-test-1" ]; then
CFG_PATH=${CFG_PATH}/pandora_tendis_sea
auto_parse_worldid
elif [ $HOSTNAME = "pandora-dev2" ]; then
CFG_PATH=${CFG_PATH}/pandora_test_mysql
auto_parse_worldid
elif [ $HOSTNAME = "pandora-se-test-jp" ]; then
CFG_PATH=${CFG_PATH}/pandora_tendis_jp
auto_parse_worldid
elif [ $RLS_AREA -eq 1 ] ; then
CFG_PATH=${CFG_PATH}/pdr_rls_jp2
auto_parse_worldid
elif [ $RLS_AREA -eq 2 ] ; then
CFG_PATH=${CFG_PATH}/pdr_rls_kr
auto_parse_worldid
elif [ $RLS_AREA -eq 3 ] ; then
CFG_PATH=${CFG_PATH}/anhei_cn
auto_parse_worldid
elif [ $RLS_AREA -eq 4 ] ; then
CFG_PATH=${CFG_PATH}/pdr_rls_en
auto_parse_worldid
elif [ $RLS_AREA -eq 5 ] ; then
CFG_PATH=${CFG_PATH}/anhei_cn2
auto_parse_worldid
elif [ $HOSTNAME = "winbuild" ] ; then
CFG_PATH=${CFG_PATH}/winbuild
elif [ $HOSTNAME = "hy-virtual-machine" ] ; then
CFG_PATH=${CFG_PATH}/vm200
elif [ $HOSTNAME = "pandora-tower" ] ; then
CFG_PATH=${CFG_PATH}/pandora_tower
else
CFG_PATH=${CFG_PATH}/standalone
fi
echo $CFG_PATH
wait_to_stop_svr()
{
#上一次如果是直接kill,checkfile会一直存在,gamesvr会无法启动。
#linux下面直接grep进程,cygwin由于自带的ps无法获得windows进程的命令行参数不能这么处理。
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!wait svr stop ......" $1 $2 $3
system=`uname -o`
for((i=1;i<=$3;i++))
do
if [ "Cygwin" == ${system} ]; then
#CHECKFILE="./sog_shf_"1.$2.$i
while true
do
WMIC=`wmic process where "name='SogLoader.exe' and CommandLine like '%$WORLD_ID.$2.$i%'" Get commandline | wc -l`
#WMIC="`wmic process where \"name='SogLoader.exe' and CommandLine like '%"1.${GAMESVR_ID}.$i"%'\" Get commandline | wc -l`"
#if [ ! -f $CHECKFILE ]; then
if [ $WMIC -ne 2 ]; then
echo "wait svr stop ......" $1 $i
sleep 2
else
break
fi
done
else
while true
do
PROC=`ps aux | grep SogLoader |grep "name=$1 " | grep -v "grep" | wc -l`
if [ $PROC -ne 0 ]; then
echo "wait svr stop ......" $1 $i
sleep 2
else
break
fi
done
fi
done
}