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
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