def signal_terminate(on_terminate):
    """a common case program termination signal"""
    for i in [signal.SIGINT, signal.SIGQUIT, signal.SIGUSR1, signal.SIGUSR2, signal.SIGTERM]:
        signal.signal(i, on_terminate)
a common case program termination signal