1

I would like to run the job at :00, :05 , :10, :15, :20, ....., :55.

So, if the execution of code started at 16:31:10 the job should run at 16:35:00

Am using the below code:

import schedule
import time
from datetime import datetime, timezone, timedelta


print("Started Exec:- " + str(datetime.now()))

def job():
    print("Job:- " + str(datetime.now()))


schedule.every(5).minutes.do(job)


while True:
    schedule.run_pending()
    time.sleep(1)

But the job ran at 16:36:10

enter image description here

selet
  • 31
  • 3
  • Does [this](https://stackoverflow.com/questions/64963033/python-schedule-not-running-as-scheduled) help? Or, maybe it's because you're using `while True` (the code runs every time as there are no conditions for it to run). See https://stackoverflow.com/questions/3754620/what-does-while-true-mean-in-python. While what is true? – The Amateur Coder Apr 23 '22 at 11:23

0 Answers0