From abfd50aacd3e6cbe650461006843e8a394b78318 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 28 Feb 2013 22:23:25 +0100 Subject: Fix signal handling - reload the config/theme with SIGUSR1 - quit properly with SIGHUP/SIGTERM --- src/core.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 4d1bf45a..05814f19 100644 --- a/src/core.py +++ b/src/core.py @@ -268,12 +268,12 @@ class Core(object): self.pending_invites = {} - def sighup_handler(self, num, stack): + def sigusr_handler(self, num, stack): """ - Handle SIGHUP (1) + Handle SIGUSR1 (10) When caught, reload all the possible files. """ - log.debug("SIGHUP caught, reloading the files…") + log.debug("SIGUSR1 caught, reloading the files…") # reload all log files log.debug("Reloading the log files…") logger.reload_all() @@ -287,6 +287,13 @@ class Core(object): config.__init__(config.file_name) log.debug("Config reloaded.") + def exit_from_signal(self, *args, **kwargs): + """ + Quit when receiving SIGHUP or SIGTERM + """ + log.debug("Either SIGHUP or SIGTERM received. Exiting…") + self.command_quit() + def autoload_plugins(self): """ Load the plugins on startup. -- cgit v1.2.3