#!/usr/bin/env python import time import os import signal def main(): print "start process" os.kill(os.getpid(),signal.SIGKILL) time.sleep(60) print "end process" if __name__ == '__main__': main()
执行结果:
start process Killed
通过signall.SIGKILL在指定位置结束正在执行的进程
原文地址:http://blog.51cto.com/guoshiwei/2103499