import time, os, sched
schedule = sched.scheduler(time.time, time.sleep)
def perform_command(cmd, inc):
schedule.enter(inc, 0, perform_command, (cmd, inc))
os.system(cmd)
def timming_exe(cmd, inc = 60):
schedule.enter(inc, 0, perform_command, (cmd, inc))
schedule.run()
print("Clear up expire session by timer")
os.chdir('D:/workspace/busymonkey')
timming_exe("python manage.py clearsessions", 20)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/16589.html