2024-03-02 10:38:32 +08:00
|
|
|
import schedule
|
|
|
|
import time
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
def job():
|
2024-03-02 10:42:23 +08:00
|
|
|
subprocess.Popen(['supervisorctl reload'], shell=True)
|
2024-03-02 10:38:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
# 每半小时执行一次
|
2024-03-02 11:12:38 +08:00
|
|
|
schedule.every(10).minutes.do(job)
|
2024-03-02 10:47:31 +08:00
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
schedule.run_pending()
|
2024-03-02 11:12:38 +08:00
|
|
|
time.sleep(5)
|
2024-03-02 10:47:31 +08:00
|
|
|
except Exception as e:
|
|
|
|
subprocess.Popen(['supervisorctl reload'], shell=True)
|