def reload(self, signal, frame): self.DEBUG(addSeparator=True) self.DEBUG("Received Reload Signal. Reloading GPIOnext1!") self.DEBUG(addSeparator=True) gpio.cleanup() importlib.reload(gpio) importlib.reload(SQL) gpio.setupGPIO(self.args) SQL.init() self.devices = SQL.getDevices(DEVICE_LIST, self.args) gpio.registerDevices(self.devices)
def __init__(self, args): # Watch for system signals for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGINT]: signal.signal(sig, self.signal_handler) signal.signal(signal.SIGHUP, self.reload) self.args = args self.set_args() gpio.setupGPIO(self.args) SQL.init() self.devices = SQL.getDevices(DEVICE_LIST, self.args) gpio.registerDevices(self.devices) self.main()