1
This commit is contained in:
parent
7b5b900483
commit
75ab0d4ec4
1
server/bin/monitor.sh
Normal file
1
server/bin/monitor.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
python ../../third_party/tools/scripts/server/monitor.py wsproxy2001 '-n1 -i1'
|
@ -1,30 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
def getRuningProgramPids(progname):
|
|
||||||
pids = []
|
|
||||||
lines = os.popen('ps -ef | grep %s' % progname).readlines()
|
|
||||||
for l in lines:
|
|
||||||
line = ''
|
|
||||||
oldc = ''
|
|
||||||
for c in l.strip():
|
|
||||||
if c in [' ', '\t'] and c == oldc:
|
|
||||||
continue
|
|
||||||
oldc = c
|
|
||||||
line += c
|
|
||||||
line = line.split(' ')
|
|
||||||
|
|
||||||
if line[7] == './%s' % progname:
|
|
||||||
pids.append(line[1])
|
|
||||||
return pids
|
|
||||||
|
|
||||||
def monitor_wsp():
|
|
||||||
while True:
|
|
||||||
pids = getRuningProgramPids('wsproxy2001')
|
|
||||||
if len(pids) <= 0:
|
|
||||||
print('zzzz')
|
|
||||||
os.popen('nohup ./wsproxy2001 -n1 -i1 >> wsproxy2001.out 2>&1 &')
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
monitor_wsp()
|
|
Loading…
x
Reference in New Issue
Block a user