#!/bin/bash source ./config.sh cd ${BIN_DIR} for((i=1;i<=$GAME_COUNT;i++)) do ./SogLoader --id=${WORLD_ID}.${GAMESVR_ID}.$i --cluster=${CFG_PATH}/cluster.json --name=GameServer $@ done if [ "$1" = "stop" ] ; then wait_to_stop_svr GameServer $GAMESVR_ID $GAME_COUNT fi #CHECKFILE="./sog_shf_"1.${GAMESVR_ID}.1 #上一次如果是直接kill,checkfile会一直存在,gamesvr会无法启动。 #linux下面直接grep进程,cygwin由于自带的ps无法获得windows进程的命令行参数不能这么处理。 # if [ "$1" = "stop" ] ; then # system=`uname -o` # for((i=1;i<=$GAME_COUNT;i++)) # do # if [ "Cygwin" == ${system} ]; then # CHECKFILE="./sog_shf_"1.${GAMESVR_ID}.$i # while true # do # WMIC=`wmic process where "name='SogLoader.exe' and CommandLine like '%1.${GAMESVR_ID}.$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 # sleep 5 # else # break # fi # done # else # while true # do # PROC=`ps aux | grep "GameServer" | grep -v "grep" | wc -l` # if [ $PROC -ne 0 ]; then # sleep 50 # else # break # fi # done # fi # done # fi