python信号处理
2021-02-02 本文已影响0人
明明就_c565
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time,sys,signal
def exit(signum, frame):
print 'Exit'
sys.exit(1)
if __name__ == '__main__':
signal.signal(signal.SIGINT, exit)
signal.signal(signal.SIGTERM, exit)
while True:
time.sleep(1)