def exit_on_signal():
 def shutdown(signal, frame):
  logger.warn('Received signal %s: exiting', signal)
  sys.exit((128 + signal))
 signal.signal(signal.SIGHUP, shutdown)
 signal.signal(signal.SIGINT, shutdown)
 signal.signal(signal.SIGTERM, shutdown)

def exit_on_signal ( ) : def shutdown ( signal , frame ) : logger . warn ( 'Received signal %s: exiting' , signal ) sys . exit ( ( 128 + signal ) ) signal . signal ( signal . SIGHUP , shutdown ) signal . signal ( signal . SIGINT , shutdown ) signal . signal ( signal . SIGTERM , shutdown )
install a signal handler for hup .