wingo - in flumotion/trunk: . flumotion/common

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Tue Feb 20 18:36:24 CET 2007


Author: wingo
Date: Tue Feb 20 18:36:21 2007
New Revision: 4500

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/common/common.py
Log:
	(daemonizeHelper): Fix the post-shutdown hook, and make it so that
	if we run and there's a stale PID file, we are more tenacious.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Tue Feb 20 18:36:21 2007
@@ -2,6 +2,8 @@
 
 	* flumotion/common/common.py (daemonizeHelper): Install a
 	post-shutdown hook to delete the PID file.
+	(daemonizeHelper): Fix the post-shutdown hook, and make it so that
+	if we run and there's a stale PID file, we are more tenacious.
 
 2007-02-19  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
 

Modified: flumotion/trunk/flumotion/common/common.py
==============================================================================
--- flumotion/trunk/flumotion/common/common.py	(original)
+++ flumotion/trunk/flumotion/common/common.py	Tue Feb 20 18:36:21 2007
@@ -217,10 +217,18 @@
     ensureDir(configure.logdir, "log file")
     ensureDir(configure.rundir, "run file")
 
-    if getPid(processType, processName):
-        raise SystemError(
-            "A %s service named '%s' is already running"
-            % (processType, processName or processType))
+    pid = getPid(processType, processName):
+    if pid:
+        if checkPidRunning(pid):
+            raise SystemError(
+                "A %s service named '%s' is already running with pid %d"
+                % (processType, processName or processType, pid))
+        else:
+            log.warning(processType,
+                        "A %s service named '%s' should have been "
+                        "running with pid %d.  Restarting.", processType,
+                        processName or processType, pid)
+            deletePidFile(processName)
 
     log.info(processType, "%s service named '%s' daemonizing",
              processType, processName)
@@ -246,7 +254,7 @@
     from twisted.internet import reactor
     def deletePidFile():
         log.debug(processType, 'deleting pid file')
-        common.deletePidFile(processType)
+        deletePidFile(processType)
     reactor.addSystemEventTrigger('after', 'shutdown',
                                   deletePidFile)
 


More information about the flumotion-commit mailing list