1、示例:
def main(argv): ...................... for sig in (signal.SIGTERM, signal.SIGINT): signal.signal(sig, shutdown_signal) def shutdown_signal(signum, frame): """ 关闭掉整个进程 :param signum: :param frame: :return: """ LOG.warning("shutting down, got signal %d", signum)
2、信号
SIGINT
SIGTERM
SIGKILL
SIGALRM