pycron
pycron copied to clipboard
Simple cron-like parser for Python, which determines if current datetime matches conditions
The docs for `crontab` (https://man7.org/linux/man-pages/man5/crontab.5.html) say this: > Commands are executed by [cron(8)](https://man7.org/linux/man-pages/man8/cron.8.html) when the 'minute', 'hour', and 'month of the year' fields match the current time, _and_ at least...
Please observe the following code: import pycron from datetime import datetime last_run = datetime.strptime("11/12/2021 15:29:55", "%m/%d/%Y %H:%M:%S") current_time = datetime.strptime("11/12/2021 15:30:56", "%m/%d/%Y %H:%M:%S") print(last_run) print(current_time) print(pycron.has_been("*/10 * * * *",...
Parsing 7 as DOW is non-standard, but worth considering, as it's a fairly easy mistake to make (I know, I did it). Allowing 7 as Sunday allows also for such...
# Feature/Behavior change While working with pycron, I found that the parser itself is slow when converting/comparing a large array of datetime values. I believe this is because the parser...
Hello, Given a cron-style string, can pycron give the future closest time it will be true? Thanks!
``` from datetime import datetime import pycron if __name__ == "__main__": start_as_string = "2022-12-02 16:32:57.382138" end_as_string = "2022-12-02 16:33:01.459094" format = "%Y-%m-%d %H:%M:%S.%f" start_time = datetime.strptime(start_as_string, format) end_time = datetime.strptime(end_as_string,...
Implementation of next match and last match, would be greate to have it implemented
Would be great to implement an def function to validate if the cron string is valid, cz sometimes it is wrong and pycron.is_now("30/* * * * *", dt) will never...