Commit abfd50aa authored by mathieui's avatar mathieui
Browse files

Fix signal handling

- reload the config/theme with SIGUSR1
- quit properly with SIGHUP/SIGTERM
parent de11a00a
......@@ -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…")
......@@ -287,6 +287,13 @@ class Core(object):
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…")
def autoload_plugins(self):
Load the plugins on startup.
......@@ -31,7 +31,9 @@ def main():
cocore = singleton.Singleton(core.Core)
signal.signal(signal.SIGHUP, cocore.sighup_handler) # ignore ctrl-c
signal.signal(signal.SIGUSR1, cocore.sigusr_handler) # reload the config
signal.signal(signal.SIGHUP, cocore.exit_from_signal)
signal.signal(signal.SIGTERM, cocore.exit_from_signal)
if options.debug:
cocore.debug = True
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