[Zodb-checkins] CVS: Releases/Zope/lib/python/zdaemon - zdctl.py:1.7

Guido van Rossum guido@python.org
Tue, 26 Nov 2002 13:57:12 -0500


Update of /cvs-repository/Releases/Zope/lib/python/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv9091

Modified Files:
	zdctl.py 
Log Message:
Be more subtle in do_start() if the daemon process is already running.


=== Releases/Zope/lib/python/zdaemon/zdctl.py 1.6 => 1.7 ===
--- Releases/Zope/lib/python/zdaemon/zdctl.py:1.6	Tue Nov 26 13:28:28 2002
+++ Releases/Zope/lib/python/zdaemon/zdctl.py	Tue Nov 26 13:57:11 2002
@@ -149,6 +149,7 @@
         print "help <action> -- Print help for <action>."
 
     def do_start(self, arg):
+        self.get_status()
         if not self.zd_up:
             args = [
                 self.options.python,
@@ -165,9 +166,13 @@
                 argss.extend(["-u", str(self.options.user)])
             args.extend(self.options.program)
             os.spawnvp(os.P_WAIT, args[0], args)
-        else:
+        elif not self.zd_pid:
             self.send_action("start")
-        self.awhile(lambda: self.zd_pid, "started, pid=%(zd_pid)d")
+        else:
+            print "daemon process already running; pid=%d" % self.zd_pid
+            return
+        self.awhile(lambda: self.zd_pid,
+                    "daemon process started, pid=%(zd_pid)d")
 
     def help_start(self):
         print "start -- Start the daemon process."