Handle SIGTERM

This commit is contained in:
TheKysek 2016-10-15 17:20:14 +02:00
parent c525d4f2e1
commit 0e8f8bd85e

View File

@ -12,13 +12,14 @@ from listener import Listener
import shared import shared
def interrupt_handler(s, f): def handler(s, f):
logging.info('Gracefully shutting down MiNode') logging.info('Gracefully shutting down MiNode')
shared.shutting_down = True shared.shutting_down = True
def main(): 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.basicConfig(level=shared.log_level, format='[%(asctime)s] [%(levelname)s] %(message)s')
logging.info('Starting MiNode') logging.info('Starting MiNode')
if not os.path.exists(shared.data_directory): if not os.path.exists(shared.data_directory):