From 504e5d7d8bc9710dd28a18dcb03380ee7183483c Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 6 Oct 2009 23:37:40 -0400 Subject: [PATCH] Add bin/mailman reopen and bin/mailman restart Add .log prefix onto default logging file names. --- src/mailman/commands/cli_control.py | 46 ++++++++++++++++++++++++++++------- src/mailman/commands/docs/control.txt | 3 +++ src/mailman/config/schema.cfg | 8 +++--- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py index 919ebc0be..cab3d0fd9 100644 --- a/src/mailman/commands/cli_control.py +++ b/src/mailman/commands/cli_control.py @@ -21,6 +21,8 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ + 'Reopen', + 'Restart', 'Start', 'Stop', ] @@ -144,12 +146,14 @@ def kill_watcher(sig): -class Stop: - """Stop the Mailman daemons.""" - +class SignalCommand: + """Common base class for simple, signal sending commands.""" + implements(ICLISubCommand) - name = 'stop' + name = None + message = None + signal = None def add(self, parser, command_parser): """See `ICLISubCommand`.""" @@ -162,8 +166,32 @@ class Stop: def process(self, args): """See `ICLISubCommand`.""" - def log(message): - if not args.quiet: - print message - log(_("Shutting down Mailman's master qrunner")) - kill_watcher(signal.SIGTERM) + if not args.quiet: + print _(self.message) + kill_watcher(self.signal) + + +class Stop(SignalCommand): + """Stop the Malman daemons.""" + + name = 'stop' + message = _("Shutting down Mailman's master qrunner") + signal = signal.SIGTERM + + +class Reopen(SignalCommand): + """Reopen the Mailman daemons.""" + + name = 'reopen' + message = _('Reopening the Mailman qrunners') + signal = signal.SIGHUP + + +class Restart(SignalCommand): + """Stop the Mailman daemons.""" + + implements(ICLISubCommand) + + name = 'restart' + message = _('Restarting the Mailman qrunners') + signal = signal.SIGUSR1 diff --git a/src/mailman/commands/docs/control.txt b/src/mailman/commands/docs/control.txt index 7b7aa6195..bd1e09324 100644 --- a/src/mailman/commands/docs/control.txt +++ b/src/mailman/commands/docs/control.txt @@ -126,3 +126,6 @@ stops all the child processes too. >>> bury_master() Master process went bye bye + + +XXX We need tests for restart (SIGUSR1) and reopen (SIGHUP). diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg index 9ee45ed74..1520c4726 100644 --- a/src/mailman/config/schema.cfg +++ b/src/mailman/config/schema.cfg @@ -154,19 +154,19 @@ format: %(asctime)s (%(process)d) %(message)s datefmt: %b %d %H:%M:%S %Y propagate: no level: info -path: mailman +path: mailman.log [logging.root] [logging.archiver] [logging.bounce] -path: bounce +path: bounce.log [logging.config] [logging.debug] -path: debug +path: debug.log level: info [logging.error] @@ -182,7 +182,7 @@ level: info [logging.qrunner] [logging.smtp] -path: smtp +path: smtp.log # The smtp logger defines additional options for handling the logging of each # attempted delivery. These format strings specify what information is logged -- 2.11.4.GIT