diff options
author | martinko | 2011-09-07 08:52:08 +0000 |
---|---|---|
committer | Marko Kreen | 2011-09-07 12:58:31 +0000 |
commit | c0c754d152355e47f2605f911c204463df0b565b (patch) | |
tree | c42d8d1ff68aaab7ec1dc85e6fca35b793ff6093 | |
parent | 8d415981d80be83e0c3584665566142149564099 (diff) |
scripts/scriptmgr.py: ignoring stale pid files when starting scripts
-rwxr-xr-x | scripts/scriptmgr.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/scriptmgr.py b/scripts/scriptmgr.py index 03b3aa31..0eef0529 100755 --- a/scripts/scriptmgr.py +++ b/scripts/scriptmgr.py @@ -157,7 +157,7 @@ class ScriptMgr(skytools.DBScript): svc = job['service'] if job['disabled']: name += " (disabled)" - + if not pidfile: print(" pidfile? [%s] %s" % (svc, name)) elif os.path.isfile(pidfile): @@ -184,8 +184,11 @@ class ScriptMgr(skytools.DBScript): self.log.warning("No pidfile for %s cannot launch") return 0 if os.path.isfile(pidfile): - self.log.warning("Script %s seems running" % job_name) - return 0 + if skytools.signal_pidfile(pidfile, 0): + self.log.warning("Script %s seems running" % job_name) + return 0 + else: + self.log.info("Ignoring stale pidfile for %s" % job_name) cmd = "%(script)s %(config)s %(args)s -d" % job res = os.system(cmd) self.log.debug(res) @@ -286,4 +289,3 @@ class ScriptMgr(skytools.DBScript): if __name__ == '__main__': script = ScriptMgr('scriptmgr', sys.argv[1:]) script.start() - |