我是靠谱客的博主 现实红酒,这篇文章主要介绍python定时检查启动某个exe程序适合检测exe是否挂了,现在分享给大家,希望可以做个参考。

详见代码如下:

复制代码 代码如下:

import threading
import time
import os
import subprocess
def get_process_count(imagename):
p = os.popen('tasklist /FI "IMAGENAME eq %s"' % imagename)
return p.read().count(imagename)
def timer_start():
t = threading.Timer(120,watch_func,("is running..."))
t.start()
def watch_func(msg):
print "I'm watch_func,",msg
if get_process_count('main.exe') == 0 :
print subprocess.Popen([r'D:\shuaji\bin\main.exe'])
timer_start()
if __name__ == "__main__":
timer_start()
while True:
time.sleep(1)

最后

以上就是现实红酒最近收集整理的关于python定时检查启动某个exe程序适合检测exe是否挂了的全部内容,更多相关python定时检查启动某个exe程序适合检测exe是否挂了内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(164)

评论列表共有 0 条评论

立即
投稿
返回
顶部