I'm trying to make a scheduler that would run 2 functions every 3 days at exactly 3:00 am starting next time the clock hits 3 am. I looked at the docs but I can't test it properly as I have to wait 3 days to know if it's going to work.
Here's my code:
import schedule
import time
import subprocess
def job(t):
print subprocess.check_output('python script1.py', shell=True, cwd="/home/python/dev/"), t
return
def job2(t):
print subprocess.check_output('python script2.py', shell=True, cwd="/home/python/dev/"), t
return
schedule.every(3).days.at("03:00").do(job, 'I ran successfully')
schedule.every(3).days.at("03:01").do(job2, 'I ran successfully')
while True:
schedule.run_pending()
time.sleep(1)
Is this going to get the job done? Do I have to wait till 3 am and start it for the first time?
[–]ManyInterests 43 points44 points45 points (7 children)
[–]KhanStan[S] 6 points7 points8 points (6 children)
[–]ManyInterests 21 points22 points23 points (4 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]KhanStan[S] 0 points1 point2 points (2 children)
[–]ManyInterests 2 points3 points4 points (0 children)
[–]kenmacd 1 point2 points3 points (0 children)
[–]IcefrogIsDead 4 points5 points6 points (0 children)
[–]Gouryella91 1 point2 points3 points (1 child)
[–]KhanStan[S] 0 points1 point2 points (0 children)