Commit a88e68ba authored by 张彦钊's avatar 张彦钊

修改了restart_process参数

parent c00441ee
...@@ -80,21 +80,21 @@ def move_file(): ...@@ -80,21 +80,21 @@ def move_file():
def restart_process(): def restart_process():
out = os.popen("ps aux | grep diaryQueueUpdate.py").read() out = os.popen("ps aux | grep diaryUpdateOnlineOffline.py").read()
for line in out.splitlines(): for line in out.splitlines():
if 'python diaryQueueUpdate.py' in line: if 'python diaryUpdateOnlineOffline.py' in line:
pid = int(line.split()[1]) pid = int(line.split()[1])
# 有些进程的生命周期非常短或者随时可能结束,一定要捕捉这个异常 # 有些进程的生命周期非常短或者随时可能结束,一定要捕捉这个异常
try: try:
os.kill(pid, signal.SIGKILL) os.kill(pid, signal.SIGKILL)
print("已杀死python diaryQueueUpdate.py 进程") print("已杀死python diaryUpdateOnlineOffline.py 进程")
except OSError: except OSError:
print('没有如此进程!!!') print('没有如此进程!!!')
os.popen('python diaryQueueUpdate.py') os.popen('python diaryUpdateOnlineOffline.py')
print("成功重启diaryQueueUpdate") print("成功重启diaryUpdateOnlineOffline.py")
else: else:
os.popen('python diaryQueueUpdate.py') os.popen('python diaryUpdateOnlineOffline.py')
print("成功重启diaryQueueUpdate") print("成功重启diaryUpdateOnlineOffline.py")
# 把数据写到redis里 # 把数据写到redis里
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment