您的位置:首页 > 编程语言 > Python开发

迅雷下载最近经常异常崩溃,下个Python脚本自动监控重启之

2015-07-30 09:54 1006 查看
import os
import time
import subprocess

if __name__=="__main__":
    print("keep xunlei running");
    while 1:
        str = subprocess.check_output('tasklist')
        print str
        if str.find('ThunderPortable.exe')==-1:
            print("xunlei is crashed, restart");
            #os.spawnl(os.P_NOWAIT, r'C:\ThunderPortable\ThunderPortable.exe')
            subprocess.Popen(["ThunderPortable.exe"])
        else:
            print("xunlei is running!");
        time.sleep(30)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: