sigint handler added

This commit is contained in:
Wolfgang Hottgenroth
2022-02-04 22:28:36 +01:00
parent 8e0a525beb
commit 8a32e05673

View File

@ -5,6 +5,8 @@ import argparse
import json
import threading
import queue
import signal
deathBell = threading.Event()
@ -14,6 +16,12 @@ def exceptHook(args):
deathBell.set()
logger.error("rang the death bell")
def terminateHook(sig, frame):
global deathBell
logger.error("SIGINT received")
deathBell.set()
logger.error("rang the death bell")
logger.info("opcua2mqtt bridge starting")
@ -44,6 +52,9 @@ for o in config['opcua']:
threading.excepthook = exceptHook
logger.info("Threading excepthook set")
signal.signal(signal.SIGINT, terminateHook)
logger.info("SIGINT handler set")
logger.info("opcua2mqtt bridge is running")