zephyr_mirror: More reliable killing of other zephyr_mirror processes.

(imported from commit ae00299114a74ebd582aec835ffd5f8127d8f55f)
This commit is contained in:
Tim Abbott 2012-10-30 16:47:05 -04:00
parent 0267275cfd
commit 205ad41a22

View file

@ -168,6 +168,8 @@ def maybe_restart_mirroring_script():
os.kill(child_pid, signal.SIGKILL) os.kill(child_pid, signal.SIGKILL)
while True: while True:
try: try:
if bot_name == "extra_mirror.py":
os.execvp(root_path + "/extra_mirror.py", sys.argv)
os.execvp(root_path + "/user_root/zephyr_mirror.py", sys.argv) os.execvp(root_path + "/user_root/zephyr_mirror.py", sys.argv)
except: except:
print "Error restarting, trying again." print "Error restarting, trying again."
@ -534,7 +536,11 @@ if options.forward_from_humbug:
# First check that there are no other bots running # First check that there are no other bots running
cmdline = " ".join(sys.argv) cmdline = " ".join(sys.argv)
proc = subprocess.Popen(['pgrep', '-U', os.environ["USER"], "-f", cmdline], if "extra_mirror" in cmdline:
bot_name = "extra_mirror.py"
else:
bot_name = "zephyr_mirror.py"
proc = subprocess.Popen(['pgrep', '-U', os.environ["USER"], "-f", bot_name],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
out, _err_unused = proc.communicate() out, _err_unused = proc.communicate()