Skip to content

ivica-k/cronrange.info

Repository files navigation

cron_range Build Status

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.

Usage

Web

CLI

python chalicelib/cronrange.py
Options
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.
Examples
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

Local API server

make local
curl -H "Content-Type:application/json" \
 -d '{"executions": "10", "cron":"*/5 * * * *"}' \
 localhost:8000
JSON structure
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 support

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.

For developers

Virtualenv setup

make venv

Running tests

make test

Running a local server

make local

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published