schedule
schedule copied to clipboard
How to do job once at a specific date and time?
Hello!
I need a Python script that executes some task once in a specific date and time? Can I do it using Schedule? In the documentation I've found such a code:
schedule.every().day.at('22:30').do(job_that_executes_once)
It works, but I need something like this:
schedule.every().day.at('2022-04-03 22:30').do(job_that_executes_once)
But this code returns an error. Can I do it in some way?
Thanks!
https://schedule.readthedocs.io/en/stable/examples.html#run-a-job-once so i would do the following:
- Run the job every day at 22:30
- inside the called function check if the date is the correct one
- if it is the correct one, run the code and finally cancel the job
- if the date isn't the correct one, break out from the job