Kill duplicate zephyr mirror processes on startup.
(imported from commit 52db0c911e5d60a54eb43c5c075709c02e75da63)
This commit is contained in:
parent
0ff7cb650f
commit
2931346c5e
|
@ -440,6 +440,18 @@ if options.forward_from_humbug:
|
|||
print "This option is obsolete."
|
||||
sys.exit(0)
|
||||
|
||||
# First check that there are no other bots running
|
||||
cmdline = " ".join(sys.argv)
|
||||
proc = subprocess.Popen(['pgrep', '-U', os.environ["USER"], "-f", cmdline],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, _err_unused = proc.communicate()
|
||||
for pid in out.split():
|
||||
if int(pid.strip()) != os.getpid():
|
||||
# Another copy of zephyr_mirror.py! Kill it.
|
||||
print "Killing duplicate zephyr_mirror process %s" % pid
|
||||
os.kill(int(pid), signal.SIGKILL)
|
||||
|
||||
child_pid = os.fork()
|
||||
if child_pid == 0:
|
||||
# Run the humbug => zephyr mirror in the child
|
||||
|
|
Loading…
Reference in a new issue