1
This commit is contained in:
parent
4606e07550
commit
fc41c2e8e3
@ -1,9 +1,9 @@
|
|||||||
cd third_party/wsproxy/server/wsproxy
|
cd third_party/wsproxy/server/wsproxy
|
||||||
python ../tools/scripts/construct/build_pb.py --nohooks 1
|
python ../tools/scripts/construct/build_pb.py --nohooks 1
|
||||||
cmake $1 .
|
cmake -DGAME_ID=2002 -DMASTER_MODE=1 .
|
||||||
make clean
|
make clean
|
||||||
make
|
make
|
||||||
cp ../bin/wsproxy ../../../../bin/
|
cp ../bin/wsproxy ../../../../bin/wsproxy${GAME_ID}
|
||||||
|
|
||||||
cd ../../../../
|
cd ../../../../
|
||||||
|
|
||||||
|
@ -28,16 +28,16 @@ def getExePath(pid):
|
|||||||
def getExeCmdLine(pid):
|
def getExeCmdLine(pid):
|
||||||
return os.popen('cat /proc/%d/cmdline' % int(pid)).read()
|
return os.popen('cat /proc/%d/cmdline' % int(pid)).read()
|
||||||
|
|
||||||
def stop(instance_id):
|
def stop(instance_id, node_id):
|
||||||
wsproxy_ids = getRuningProgramPids('wsproxy')
|
wsproxy_ids = getRuningProgramPids('wsproxy')
|
||||||
pids = wsproxy_ids
|
pids = wsproxy_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
exepath = getExePath(pid)
|
exepath = getExePath(pid)
|
||||||
cmdline = getExeCmdLine(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))
|
os.popen('kill -9 %d' % int(pid))
|
||||||
|
|
||||||
def listserver():
|
def listServer():
|
||||||
wsproxy_ids = getRuningProgramPids('wsproxy')
|
wsproxy_ids = getRuningProgramPids('wsproxy')
|
||||||
pids = wsproxy_ids
|
pids = wsproxy_ids
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
@ -45,30 +45,31 @@ def listserver():
|
|||||||
cmdline = getExeCmdLine(pid)
|
cmdline = getExeCmdLine(pid)
|
||||||
print(pid, exepath, cmdline)
|
print(pid, exepath, cmdline)
|
||||||
|
|
||||||
def restartServer(str_instance_ids):
|
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('wsproxy %d starting......' % instance_id)
|
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)
|
os.popen(cmd)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
print('usuage: [restart]')
|
print('usuage: [restart stop list]')
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if len(argv) == 1:
|
if len(argv) == 1:
|
||||||
printHelp()
|
printHelp()
|
||||||
else:
|
else:
|
||||||
if argv[1] == 'restart':
|
if argv[1] == 'restart':
|
||||||
restartServer(argv[2])
|
restartServer(argv[2], argv[3])
|
||||||
elif argv[1] == 'stop':
|
elif argv[1] == 'stop':
|
||||||
stop()
|
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,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
python manage.py restart $1
|
python manage.py restart $1 $2
|
||||||
|
|
||||||
echo 'success'
|
echo 'success'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
nohup ./wsproxy -i $1 >> wsproxy$1.out 2>&1 &
|
nohup ./$3 -i $1 -n $2 >> $3$2_$1.out 2>&1 &
|
||||||
|
@ -58,7 +58,7 @@ def restartServer(str_instance_ids, str_node_id):
|
|||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
print('usuage: [restart]')
|
print('usuage: [restart stop list]')
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if len(argv) == 1:
|
if len(argv) == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user