1
This commit is contained in:
parent
c76b11503c
commit
ee7e8e2c28
@ -31,25 +31,25 @@ def getExeCmdLine(pid):
|
|||||||
def stop(instance_id, node_id, times = 0):
|
def stop(instance_id, node_id, times = 0):
|
||||||
if times > 2:
|
if times > 2:
|
||||||
return
|
return
|
||||||
gameserver_ids = getRuningProgramPids('gameserver')
|
gameserver_ids = getRuningProgramPids('gameserver2001')
|
||||||
pids = gameserver_ids
|
pids = gameserver_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
exepath = getExePath(pid)
|
exepath = getExePath(pid)
|
||||||
cmdline = getExeCmdLine(pid)
|
cmdline = getExeCmdLine(pid)
|
||||||
if cmdline.find("./gameserver\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)) > -1:
|
if cmdline.find("./gameserver2001\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)) > -1:
|
||||||
os.popen('kill -9 %d' % int(pid))
|
os.popen('kill -9 %d' % int(pid))
|
||||||
#endfor
|
#endfor
|
||||||
gameserver_ids = getRuningProgramPids('gameserver')
|
gameserver_ids = getRuningProgramPids('gameserver2001')
|
||||||
pids = gameserver_ids
|
pids = gameserver_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
exepath = getExePath(pid)
|
exepath = getExePath(pid)
|
||||||
cmdline = getExeCmdLine(pid)
|
cmdline = getExeCmdLine(pid)
|
||||||
if cmdline.find("./gameserver\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)) > -1:
|
if cmdline.find("./gameserver2001\0-i\0%d\0-n\0%d\0" % (instance_id, node_id)) > -1:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
stop(instance_id, node_id, times + 1)
|
stop(instance_id, node_id, times + 1)
|
||||||
|
|
||||||
def listServer():
|
def listServer():
|
||||||
gameserver_ids = getRuningProgramPids('gameserver')
|
gameserver_ids = getRuningProgramPids('gameserver2001')
|
||||||
pids = gameserver_ids
|
pids = gameserver_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
exepath = getExePath(pid)
|
exepath = getExePath(pid)
|
||||||
@ -63,7 +63,7 @@ def restartServer(str_instance_ids, str_node_id):
|
|||||||
instance_id = int(instance_id)
|
instance_id = int(instance_id)
|
||||||
stop(instance_id, node_id)
|
stop(instance_id, node_id)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
print('gameserver %d starting......' % instance_id)
|
print('gameserver2001 %d starting......' % instance_id)
|
||||||
cmd = 'sh start_instance.sh %d %d' % (instance_id, node_id)
|
cmd = 'sh start_instance.sh %d %d' % (instance_id, node_id)
|
||||||
os.popen(cmd)
|
os.popen(cmd)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
source /etc/profile
|
source /etc/profile
|
||||||
source /root/.bash_profile
|
source /root/.bash_profile
|
||||||
|
|
||||||
nohup ./gameserver -i $1 -n $2 -f1,2,3,4,6>> gameserver$2_$1.out 2>&1 &
|
nohup ./gameserver2001 -i $1 -n $2 >> gameserver$2_$1.out 2>&1 &
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user