From 0e8f8bd85ee8b3c2961743ee498d4d862fd2e24d Mon Sep 17 00:00:00 2001 From: TheKysek Date: Sat, 15 Oct 2016 17:20:14 +0200 Subject: [PATCH] Handle SIGTERM --- src/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 59bcff7..13b561e 100644 --- a/src/main.py +++ b/src/main.py @@ -12,13 +12,14 @@ from listener import Listener import shared -def interrupt_handler(s, f): +def handler(s, f): logging.info('Gracefully shutting down MiNode') shared.shutting_down = True def main(): - signal.signal(signal.SIGINT, interrupt_handler) + signal.signal(signal.SIGINT, handler) + signal.signal(signal.SIGTERM, handler) logging.basicConfig(level=shared.log_level, format='[%(asctime)s] [%(levelname)s] %(message)s') logging.info('Starting MiNode') if not os.path.exists(shared.data_directory):