Displays the next N number of executions for a given cron expression. Now with support for AWS EventBridge expressions!
Comes with a cronrange
library based on croniter that you can run from the CLI,
or from an API built with AWS Chalice and API Gateway on cronrange.info.
Visit cronrange.info
python chalicelib/cronrange.py
Option | Description | Default value |
---|---|---|
-c/--cron |
A cron expression (string) | None |
-n/--executions |
Number of next executions to show. | 5 |
-d/--start-date |
Date and time in DD.MM.YYYY. HH:MM format from which to calculate cron executions. | Current date and time. |
python chalicelib/cronrange.py -c "*/5 * * * *"
python chalicelib/cronrange.py -c "5 * * * *" -d "23.11.1999. 19:30"
python chalicelib/cronrange.py -c "5 * * * *" -d "23.11.1999. 19:30" -n 50
# AWS EventBridge compatible expressions
python chalicelib/cronrange.py -c "15 12 * * ? *"
python chalicelib/cronrange.py -c "0 10 1 JAN,FEB,MAR ? *" -d "28.11.2021. 20:00"
python chalicelib/cronrange.py -c "0/50 8-17 ? * THU-FRI *" -d "27.11.2021. 19:30" -n 50
make local
curl -H "Content-Type:application/json" \
-d '{"executions": "10", "cron":"*/5 * * * *"}' \
localhost:8000
Key | Description | Default value |
---|---|---|
cron |
A cron expression (string) | None |
executions |
Number of next executions to show. | 10 |
start_date |
Date and time in DD.MM.YYYY. HH:MM format from which to calculate cron executions. |
Current date and time. |
AWS EventBridge implementation of cron does not use 0 based day of week, instead it is 1-7 SUN-SAT
(instead of 0-6
),
as well as supporting additional expression features such as first-weekday and last-day-of-month. Source
Because of that, cronrange
does not support the full range of expression wildcards available on AWS EventBridge.
Wildcard | Example expression | Supported |
---|---|---|
L |
*/5 * L * ? * |
Yes |
W |
*/30 * 1W * ? * |
No |
# |
*/30 * ? * 3#2 * |
No |
? |
0 8 1 * ? * |
Yes |
Classic cron expression wildcards such as ,
, /
, -
and *
are supported.
make venv
make test
make local