From bd3c2f9d5612799c077492e2b574c4d9551d7c66 Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 9 Nov 2010 18:17:50 +0000 Subject: [PATCH 1/1] Enhanced do_start() implementation in Python management script Unclean shutdowns and fork() misery can create PID files that have no actual process behind them. Instead of just trusting the PID file, check for the running PID; if the process is not running, then remove the PID file and actually start the service. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2070 9efc2488-bf62-4759-914b-345cdb29e865 --- src/python/opensrf.py.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/python/opensrf.py.in b/src/python/opensrf.py.in index bd6c4f0..809946b 100755 --- a/src/python/opensrf.py.in +++ b/src/python/opensrf.py.in @@ -113,8 +113,13 @@ def do_start(service): return if os.path.exists(pidfile): - print "* service %s already running" % service - return + try: + pid_fd = open(pidfile, 'r') + alive = os.getsid(int(pid_fd.read())) + print "* service %s already running" % service + return + except OSError: + os.remove(pidfile) print "* starting %s" % service -- 2.43.2