ok
This commit is contained in:
parent
171592ad77
commit
30f3a37b5a
@ -37,7 +37,7 @@ def stop(instance_id, node_id):
|
|||||||
if cmdline == ("./gameserver\0-i\0%d\0-i\0%d\0" % (instance_id, node_id)):
|
if cmdline == ("./gameserver\0-i\0%d\0-i\0%d\0" % (instance_id, node_id)):
|
||||||
os.popen('kill -9 %d' % int(pid))
|
os.popen('kill -9 %d' % int(pid))
|
||||||
|
|
||||||
def listserver():
|
def listServer():
|
||||||
gameserver_ids = getRuningProgramPids('gameserver')
|
gameserver_ids = getRuningProgramPids('gameserver')
|
||||||
pids = gameserver_ids
|
pids = gameserver_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
@ -45,14 +45,15 @@ def listserver():
|
|||||||
cmdline = getExeCmdLine(pid)
|
cmdline = getExeCmdLine(pid)
|
||||||
print(pid, exepath, cmdline)
|
print(pid, exepath, cmdline)
|
||||||
|
|
||||||
def restartServer(str_instance_ids, node_id):
|
def restartServer(str_instance_ids, str_node_id):
|
||||||
instance_ids = str_instance_ids.split(',')
|
instance_ids = str_instance_ids.split(',')
|
||||||
|
node_id = int(str_node_id)
|
||||||
for instance_id in instance_ids:
|
for instance_id in instance_ids:
|
||||||
instance_id = int(instance_id)
|
instance_id = int(instance_id)
|
||||||
stop(instance_id)
|
stop(instance_id, node_id)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
print('gameserver %d starting......' % instance_id)
|
print('gameserver %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)
|
os.popen(cmd)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ def main(argv):
|
|||||||
elif argv[1] == 'stop':
|
elif argv[1] == 'stop':
|
||||||
stop(argv[2], argv[3])
|
stop(argv[2], argv[3])
|
||||||
elif argv[1] == 'list':
|
elif argv[1] == 'list':
|
||||||
listserver()
|
listServer()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
nohup ./gameserver -i $1 -n $2>> gameserver$1_$2.out 2>&1 &
|
nohup ./gameserver -i $1 -n $2>> gameserver$2_$1.out 2>&1 &
|
||||||
|
Loading…
x
Reference in New Issue
Block a user