diff --git a/server/bin/monitor.sh b/server/bin/monitor.sh new file mode 100644 index 0000000..4b6313b --- /dev/null +++ b/server/bin/monitor.sh @@ -0,0 +1 @@ +python ../../third_party/tools/scripts/server/monitor.py masterserver2001 '-n1 -i1' diff --git a/server/bin/monitor_masterserver.py b/server/bin/monitor_masterserver.py deleted file mode 100644 index 6e58304..0000000 --- a/server/bin/monitor_masterserver.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -import os -import sys -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_ms(gameid): - gameid = gameid.strip(); - if gameid== '': - return - while True: - pids = getRuningProgramPids(f'masterserver{gameid}') - if len(pids) <= 0: - print('zzzz') - os.popen(f'nohup ./masterserver{gameid} -n1 -i1 -f1,2,4 >> masterserver{gameid}.out 2>&1 &') - time.sleep(2) - -monitor_ms(sys.argv[1]) diff --git a/third_party/tools b/third_party/tools index 89d4afa..43a09bd 160000 --- a/third_party/tools +++ b/third_party/tools @@ -1 +1 @@ -Subproject commit 89d4afa65c9b905ea1ac114a1280b5dd203a7ad7 +Subproject commit 43a09bd136f0d28c61cd03103b9d151af1317381