[Zope-Checkins] CVS: ZODB3/zdaemon - zdaemon.py:1.4

Guido van Rossum guido@python.org
Mon, 11 Nov 2002 09:53:33 -0500


Update of /cvs-repository/ZODB3/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv8537

Modified Files:
	zdaemon.py 
Log Message:
Don't restart on exit status 0.


=== ZODB3/zdaemon/zdaemon.py 1.3 => 1.4 ===
--- ZODB3/zdaemon/zdaemon.py:1.3	Fri Nov  8 16:51:23 2002
+++ ZODB3/zdaemon/zdaemon.py	Mon Nov 11 09:53:32 2002
@@ -17,10 +17,10 @@
 application in the background, detached from the foreground tty
 session that started it (if any).
 
-Important: if at any point the application exits with exit status 2,
-it is not restarted.  Any other form of termination (either being
-killed by a signal or exiting with an exit status other than 2) causes
-it to be restarted.
+Important: if at any point the application exits with exit status 0 or
+2, it is not restarted.  Any other form of termination (either being
+killed by a signal or exiting with an exit status other than 0 or 2)
+causes it to be restarted.
 
 Backoff limit: when the application exits (nearly) immediately after a
 restart, the daemon manager starts slowing down by delaying between
@@ -39,17 +39,13 @@
 """
 XXX TO DO
 
-- A way to stop both the daemon manager and the application.
-
-- A way to restart the application.
-
-- More control over logging (zdaemon logging should be controllable
-  separate from application logging).
+- Read commands from a Unix-domain socket, to stop, start and restart
+  the application, and to stop the daemon manager.
 
 """
 
 import os
-assert os.name == "posix" # This code has many Unix-specific assumptions
+assert os.name == "posix", "This code makes many Unix-specific assumptions"
 import sys
 import time
 import getopt
@@ -230,6 +226,7 @@
             msg = "pid %d: exit status %s" % (pid, es)
             if es == 0:
                 self.info(msg)
+                self.exit(0)
             elif es == 2:
                 self.problem(msg)
                 self.exit(es)