Commit ed5e5583 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 498cdbb1
...@@ -88,9 +88,9 @@ def setup_signals(storages): ...@@ -88,9 +88,9 @@ def setup_signals(storages):
else: else:
signal.signal(xfsz, signal.SIG_IGN) signal.signal(xfsz, signal.SIG_IGN)
signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages)) 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: try:
signal.signal(signal.SIGHUP, rotate_logs_handler) signal.signal(signal.SIGUSR2, rotate_logs_handler)
except: except:
pass pass
...@@ -223,7 +223,7 @@ def main(argv): ...@@ -223,7 +223,7 @@ def main(argv):
pass pass
else: else:
import zdaemon import zdaemon
zdaemon.run(sys.argv, '') zdaemon.run(sys.argv, env.zeo_pid)
try: try:
...@@ -258,13 +258,14 @@ def main(argv): ...@@ -258,13 +258,14 @@ def main(argv):
ZEO.StorageServer.StorageServer(unix, storages) ZEO.StorageServer.StorageServer(unix, storages)
if not Z:
try: try:
ppid, pid = os.getppid(), os.getpid() pid = os.getpid()
except: except:
pass # getpid not supported pass # getpid not supported
else: else:
f = open(env.zeo_pid, 'w') f = open(env.zeo_pid, 'w')
f.write("%s %s\n" % (ppid, pid)) f.write("%s\n" % pid)
f.close() f.close()
except: except:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment