This commit is contained in:
aozhiwei 2019-01-12 19:00:55 +08:00
parent 580d6001fa
commit b0b795a824
6 changed files with 14 additions and 14 deletions

View File

@ -1,9 +1,9 @@
cd third_party/wsproxy/server/wsproxy cd third_party/dbproxy/server/dbproxy
python ../tools/scripts/construct/build_pb.py python ../tools/scripts/construct/build_pb.py
cmake . cmake .
make clean make clean
make make
cp ../bin/wsproxy ../../../../bin/ cp ../bin/dbproxy ../../../../bin/
cd ../../../../ cd ../../../../

View File

@ -29,21 +29,21 @@ 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):
wsproxy_ids = getRuningProgramPids('wsproxy') dbproxy_ids = getRuningProgramPids('dbproxy')
pids = wsproxy_ids pids = dbproxy_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 == ("./dbproxy\0-i\0%d\0" % instance_id):
os.popen('kill -9 %d' % int(pid)) os.popen('kill -9 %d' % int(pid))
def listserver(): def listserver():
wsproxy_ids = getRuningProgramPids('wsproxy') dbproxy_ids = getRuningProgramPids('dbproxy')
pids = wsproxy_ids pids = dbproxy_ids
for pid in pids: for pid in pids:
exepath = getExePath(pid) exepath = getExePath(pid)
cmdline = getExeCmdLine(pid) cmdline = getExeCmdLine(pid)
print pid, exepath, cmdline print(pid, exepath, cmdline)
def restartServer(str_instance_ids): def restartServer(str_instance_ids):
instance_ids = str_instance_ids.split(',') instance_ids = str_instance_ids.split(',')
@ -51,13 +51,13 @@ def restartServer(str_instance_ids):
instance_id = int(instance_id) instance_id = int(instance_id)
stop(instance_id) stop(instance_id)
time.sleep(0.5) time.sleep(0.5)
print 'wsproxy %d starting......' % instance_id print('dbproxy %d starting......' % instance_id)
cmd = 'sh start_instance.sh %d' % (instance_id) cmd = 'sh start_instance.sh %d' % (instance_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]')
def main(argv): def main(argv):
if len(argv) == 1: if len(argv) == 1:

View File

@ -0,0 +1,4 @@
#!/bin/bash
cd bin
nohup ./dbproxy -i $1 >> dbproxy$1.out 2>&1 &

View File

@ -1,4 +0,0 @@
#!/bin/bash
cd bin
nohup ./wsproxy -i $1 >> wsproxy$1.out 2>&1 &