渭南建设网站,怎么把自己的网站推广出去,网站设计需求说明书,域名对网站有什么影响吗背景#xff1a; 需要每天定时去检测crontab进程是否启动#xff0c;所以不能用crontab来启动检测脚本了#xff0c;直接使用while 循环和sleep方式实现定时检测 # coding:utf-8
import os
import send_message
import datetime
import timecurr_time datetime.datetime.no… 背景 需要每天定时去检测crontab进程是否启动所以不能用crontab来启动检测脚本了直接使用while 循环和sleep方式实现定时检测 # coding:utf-8
import os
import send_message
import datetime
import timecurr_time datetime.datetime.now()
time_str datetime.datetime.strftime(curr_time,%H:%M:%S)def loopMonitor():curr_time datetime.datetime.now()time_str datetime.datetime.strftime(curr_time,%H:%M)if time_str 08:05:print come in alreadycheck_process()return#2s检查一次time.sleep(60)loopMonitor()def check_process():process./cron.lockos.system(ps -ef|grep python3|grep -v grep %s % process)if not(os.path.getsize(process)):send_message.send_message(crontab not running, [8618320120156])else:fopen(./cron.lock, r)f.truncate()if __name__ __main__:loopMonitor() 转载于:https://www.cnblogs.com/gcgc/p/11471448.html