From f1ccc9033618d24da93cd10529faea5a7eaa20be Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 22 Apr 2024 19:14:18 +0100 Subject: [PATCH] Ignore sighup when daemonized It seems like systemd sends this as well as SIGTERM, so make sure to ignore it so we shut down cleanly. --- calm/calm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/calm/calm.py b/calm/calm.py index abadf72..02e613b 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -740,8 +740,12 @@ def sigterm(signum, frame): running = False raise InterruptedError + def sighup(signum, frame): + logging.debug("SIGHUP") + context.signal_map = { signal.SIGTERM: sigterm, + signal.SIGHUP: sighup, } with context: