From 958a673379014240e1e7c57921d243379288eb78 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 31 Aug 2019 17:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=80=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/tools/scripts/ci/gameserver/manage.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/tools/scripts/ci/gameserver/manage.py b/server/tools/scripts/ci/gameserver/manage.py index 0fbe763..583a0f1 100755 --- a/server/tools/scripts/ci/gameserver/manage.py +++ b/server/tools/scripts/ci/gameserver/manage.py @@ -28,7 +28,9 @@ def getExePath(pid): def getExeCmdLine(pid): return os.popen('cat /proc/%d/cmdline' % int(pid)).read() -def stop(instance_id, node_id): +def stop(instance_id, node_id, times = 0): + if times > 2: + return gameserver_ids = getRuningProgramPids('gameserver') pids = gameserver_ids for pid in pids: @@ -36,6 +38,15 @@ def stop(instance_id, node_id): cmdline = getExeCmdLine(pid) if cmdline == ("./gameserver\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)): os.popen('kill -9 %d' % int(pid)) + #endfor + gameserver_ids = getRuningProgramPids('gameserver') + pids = gameserver_ids + for pid in pids: + exepath = getExePath(pid) + cmdline = getExeCmdLine(pid) + if cmdline == ("./gameserver\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)): + time.sleep(1) + stop(instance_id, node_id, times + 1) def listServer(): gameserver_ids = getRuningProgramPids('gameserver')