From fc41c2e8e3f9832d22d48b6105881082f0401c18 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 28 Nov 2019 14:01:12 +0800 Subject: [PATCH] 1 --- server/tools/scripts/ci/wsproxy/boundle.sh | 4 ++-- server/tools/scripts/ci/wsproxy/manage.py | 21 ++++++++++--------- server/tools/scripts/ci/wsproxy/restart.sh | 2 +- .../scripts/ci/wsproxy/start_instance.sh | 2 +- server/tools/scripts/ci/wsproxy2002/manage.py | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/server/tools/scripts/ci/wsproxy/boundle.sh b/server/tools/scripts/ci/wsproxy/boundle.sh index e06e3e5..815745a 100644 --- a/server/tools/scripts/ci/wsproxy/boundle.sh +++ b/server/tools/scripts/ci/wsproxy/boundle.sh @@ -1,9 +1,9 @@ cd third_party/wsproxy/server/wsproxy python ../tools/scripts/construct/build_pb.py --nohooks 1 -cmake $1 . +cmake -DGAME_ID=2002 -DMASTER_MODE=1 . make clean make -cp ../bin/wsproxy ../../../../bin/ +cp ../bin/wsproxy ../../../../bin/wsproxy${GAME_ID} cd ../../../../ diff --git a/server/tools/scripts/ci/wsproxy/manage.py b/server/tools/scripts/ci/wsproxy/manage.py index 3d14ffa..4e9a2be 100755 --- a/server/tools/scripts/ci/wsproxy/manage.py +++ b/server/tools/scripts/ci/wsproxy/manage.py @@ -28,16 +28,16 @@ def getExePath(pid): def getExeCmdLine(pid): return os.popen('cat /proc/%d/cmdline' % int(pid)).read() -def stop(instance_id): +def stop(instance_id, node_id): wsproxy_ids = getRuningProgramPids('wsproxy') pids = wsproxy_ids for pid in pids: exepath = getExePath(pid) cmdline = getExeCmdLine(pid) - if cmdline == ("./wsproxy\0-i\0%d\0" % instance_id): + if cmdline == ("./wsproxy\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)): os.popen('kill -9 %d' % int(pid)) -def listserver(): +def listServer(): wsproxy_ids = getRuningProgramPids('wsproxy') pids = wsproxy_ids for pid in pids: @@ -45,30 +45,31 @@ def listserver(): cmdline = getExeCmdLine(pid) print(pid, exepath, cmdline) -def restartServer(str_instance_ids): +def restartServer(str_instance_ids, str_node_id): instance_ids = str_instance_ids.split(',') + node_id = int(str_node_id) for instance_id in instance_ids: instance_id = int(instance_id) - stop(instance_id) + stop(instance_id, node_id) time.sleep(0.5) print('wsproxy %d starting......' % instance_id) - cmd = 'sh start_instance.sh %d' % (instance_id) + cmd = 'sh start_instance.sh %d %d' % (instance_id, node_id) os.popen(cmd) time.sleep(0.5) def printHelp(): - print('usuage: [restart]') + print('usuage: [restart stop list]') def main(argv): if len(argv) == 1: printHelp() else: if argv[1] == 'restart': - restartServer(argv[2]) + restartServer(argv[2], argv[3]) elif argv[1] == 'stop': - stop() + stop(argv[2], argv[3]) elif argv[1] == 'list': - listserver() + listServer() if __name__ == '__main__': main(sys.argv) diff --git a/server/tools/scripts/ci/wsproxy/restart.sh b/server/tools/scripts/ci/wsproxy/restart.sh index 2d4ea42..7d3ed21 100755 --- a/server/tools/scripts/ci/wsproxy/restart.sh +++ b/server/tools/scripts/ci/wsproxy/restart.sh @@ -1,5 +1,5 @@ #!/bin/bash -python manage.py restart $1 +python manage.py restart $1 $2 echo 'success' diff --git a/server/tools/scripts/ci/wsproxy/start_instance.sh b/server/tools/scripts/ci/wsproxy/start_instance.sh index 9ee9470..0e8bc81 100755 --- a/server/tools/scripts/ci/wsproxy/start_instance.sh +++ b/server/tools/scripts/ci/wsproxy/start_instance.sh @@ -1,4 +1,4 @@ #!/bin/bash cd bin -nohup ./wsproxy -i $1 >> wsproxy$1.out 2>&1 & +nohup ./$3 -i $1 -n $2 >> $3$2_$1.out 2>&1 & diff --git a/server/tools/scripts/ci/wsproxy2002/manage.py b/server/tools/scripts/ci/wsproxy2002/manage.py index f118260..4e9a2be 100755 --- a/server/tools/scripts/ci/wsproxy2002/manage.py +++ b/server/tools/scripts/ci/wsproxy2002/manage.py @@ -58,7 +58,7 @@ def restartServer(str_instance_ids, str_node_id): time.sleep(0.5) def printHelp(): - print('usuage: [restart]') + print('usuage: [restart stop list]') def main(argv): if len(argv) == 1: