#!/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)
#!/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)
本文标题:python信号处理
本文链接:https://www.haomeiwen.com/subject/sqzytltx.html
网友评论