[Zope-Checkins] CVS: ZODB3/ZEO - start.py:1.48

Guido van Rossum guido@python.org
Thu, 10 Oct 2002 22:14:29 -0400


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv28263

Modified Files:
	start.py 
Log Message:
Signal-related changes:

1. Use SIGHUP for restart instead of SIGINT, and use SIGUSR2 to reopen
   the log file instead of SIGHUP.  This is the same standard as for
   the Zope server.

2. When using zdaemon, let zdaemon write its pid to the zeo_pid file;
   when not using zdaemon, write only our own pid to the zeo_pid
   file.  Never write two pids.


=== ZODB3/ZEO/start.py 1.47 => 1.48 ===
--- ZODB3/ZEO/start.py:1.47	Tue Oct  8 16:14:36 2002
+++ ZODB3/ZEO/start.py	Thu Oct 10 22:14:27 2002
@@ -88,9 +88,9 @@
     else:
         signal.signal(xfsz, signal.SIG_IGN)
     signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages))
-    signal.signal(signal.SIGINT, lambda sig, frame: shutdown(storages, 0))
+    signal.signal(signal.SIGHUP, lambda sig, frame: shutdown(storages, 0))
     try:
-        signal.signal(signal.SIGHUP, rotate_logs_handler)
+        signal.signal(signal.SIGUSR2, rotate_logs_handler)
     except:
         pass
 
@@ -223,7 +223,7 @@
             pass
         else:
             import zdaemon
-            zdaemon.run(sys.argv, '')
+            zdaemon.run(sys.argv, env.zeo_pid)
 
     try:
 
@@ -258,14 +258,15 @@
 
         ZEO.StorageServer.StorageServer(unix, storages)
 
-        try:
-            ppid, pid = os.getppid(), os.getpid()
-        except:
-            pass # getpid not supported
-        else:
-            f = open(env.zeo_pid, 'w')
-            f.write("%s %s\n" % (ppid, pid))
-            f.close()
+        if not Z:
+            try:
+                pid = os.getpid()
+            except:
+                pass # getpid not supported
+            else:
+                f = open(env.zeo_pid, 'w')
+                f.write("%s\n" % pid)
+                f.close()
 
     except:
         # Log startup exception and tell zdaemon not to restart us.