Commit d9361b6e authored by Dimitris Aragriorgs's avatar Dimitris Aragriorgs

Remove stale pid lock file

Signed-off-by: default avatarDimitris Aragriorgs <dimara@grnet.gr>
parent 4a3ed624
...@@ -31,6 +31,7 @@ import traceback ...@@ -31,6 +31,7 @@ import traceback
import subprocess import subprocess
import daemon import daemon
import daemon.runner
import daemon.pidlockfile import daemon.pidlockfile
import nfqueue import nfqueue
import pyinotify import pyinotify
...@@ -953,6 +954,12 @@ if __name__ == "__main__": ...@@ -953,6 +954,12 @@ if __name__ == "__main__":
if opts.daemonize: if opts.daemonize:
pidfile = daemon.pidlockfile.TimeoutPIDLockFile( pidfile = daemon.pidlockfile.TimeoutPIDLockFile(
config["general"]["pidfile"], 10) config["general"]["pidfile"], 10)
# Remove any stale PID files, left behind by previous invocations
if (daemon.runner.is_pidfile_stale(pidfile) or
pidfile.read_pid() is None):
logger.warning("Removing stale PID lock file %s", pidfile.path)
pidfile.break_lock()
d = daemon.DaemonContext(pidfile=pidfile, d = daemon.DaemonContext(pidfile=pidfile,
stdout=handler.stream, stdout=handler.stream,
......
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