changeset 3793:441a4136db05

standalone server: fix --pidfile option
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 23 Jun 2008 18:06:15 +0200
parents e6de0a13519c
children c62beb39c64c
files MoinMoin/script/server/standalone.py MoinMoin/server/daemon.py
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/server/standalone.py	Sun Jun 22 19:19:38 2008 +0200
+++ b/MoinMoin/script/server/standalone.py	Mon Jun 23 18:06:15 2008 +0200
@@ -121,8 +121,7 @@
                 Config.requestQueueSize = self.options.requestQueueSize
 
             if self.options.start:
-                daemon = Daemon('moin', run, Config)
-                daemon.pidfile = pidfile
+                daemon = Daemon('moin', pidfile, run, Config)
                 daemon.do_start()
             else:
                 run(Config)
--- a/MoinMoin/server/daemon.py	Sun Jun 22 19:19:38 2008 +0200
+++ b/MoinMoin/server/daemon.py	Mon Jun 23 18:06:15 2008 +0200
@@ -17,7 +17,8 @@
     # Daemon script
     import daemon
     import myserver
-    script = daemon.DaemonScript('myserver', myserver.run, myserver.Config)
+    script = daemon.DaemonScript('myserver', 'myserver.pid',
+                                 myserver.run, myserver.Config)
     script.run()
 
 
@@ -61,10 +62,11 @@
     """
     commandPrefix = 'do_'
 
-    def __init__(self, name, function, *args, **kw):
+    def __init__(self, name, pidfile, function, *args, **kw):
         """ Create a daemon
 
-        @param name: name of the process (determines pid filename, too)
+        @param name: name of the process
+        @param pidfile: pid filename
         @param function: the server main function, will block until the
             server is done.
         @param args: arguments to pass to function
@@ -74,7 +76,7 @@
         self.function = function
         self.args = args
         self.kw = kw
-        self.pidFile = os.path.abspath(name + '.pid')
+        self.pidFile = os.path.abspath(pidfile)
 
     # --------------------------------------------------------------------
     # Commands