[Zodb-checkins] CVS: ZODB3/ZEO - start.py:1.49
Guido van Rossum
guido@python.org
Fri, 11 Oct 2002 09:16:41 -0400
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv4790
Modified Files:
start.py
Log Message:
Fix a problem in rotate_logs_handler(), caused by my changing the
signal meanings: rotate_logs_handler() was changing the SIGHUP handler
to rotate the logs! zdaemon did not do anything wrong. :-)
Fixed by *removing* the signal() call inside the handler -- this is
not needed in modern Unixes.
Also changed setup_signals(): there was a typo in the name SIFXFSZ(!);
and made all the signal conditional on whether the signal module has
that particular signal (e.g. on Windows, a signal module exists, but
it only defines a few signals).
=== ZODB3/ZEO/start.py 1.48 => 1.49 ===
--- ZODB3/ZEO/start.py:1.48 Thu Oct 10 22:14:27 2002
+++ ZODB3/ZEO/start.py Fri Oct 11 09:16:40 2002
@@ -81,18 +81,14 @@
except ImportError:
return
- try:
- xfsz = signal.SIFXFSZ
- except AttributeError:
- pass
- else:
- signal.signal(xfsz, signal.SIG_IGN)
- signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages))
- signal.signal(signal.SIGHUP, lambda sig, frame: shutdown(storages, 0))
- try:
+ if hasattr(signal, 'SIGXFSZ'):
+ signal.signal(signal.SIGXFSZ, signal.SIG_IGN)
+ if hasattr(signal, 'SIGTERM'):
+ signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages))
+ if hasattr(signal, 'SIGHUP'):
+ signal.signal(signal.SIGHUP, lambda sig, frame: shutdown(storages, 0))
+ if hasattr(signal, 'SIGUSR2'):
signal.signal(signal.SIGUSR2, rotate_logs_handler)
- except:
- pass
def main(argv):
me = argv[0]
@@ -315,9 +311,6 @@
def rotate_logs_handler(signum, frame):
rotate_logs()
-
- import signal
- signal.signal(signal.SIGHUP, rotate_logs_handler)
def shutdown(storages, die=1):
LOG("ZEO/start.py", INFO, "Received signal")