From f1a02faa01549c4fd4a7ca1839da454a2ecf1f0a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 16 Dec 2019 19:02:03 +0800 Subject: [PATCH] 1 --- server/bin/monitor_game2001.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 server/bin/monitor_game2001.py diff --git a/server/bin/monitor_game2001.py b/server/bin/monitor_game2001.py deleted file mode 100644 index 89b9ad1..0000000 --- a/server/bin/monitor_game2001.py +++ /dev/null @@ -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_gs(): - while True: - pids = getRuningProgramPids('gameserver2001') - if len(pids) <= 0: - print('zzzz') - os.popen('nohup ./gameserver2001 -n1 -i1 -f1,2,4 >> gameserver2001.out 2>&1 &') - time.sleep(2) - -monitor_gs()