Cron expression generator
Set the five fields of a cron schedule, see what they mean in plain words and check the next run times before you save the job.
The five fields
A standard cron expression has five fields separated by spaces. They are minute, hour, day of month, month and day of week. A job runs when all of them match.
- Minute: 0 to 59.
- Hour: 0 to 23, on a 24-hour clock.
- Day of month: 1 to 31.
- Month: 1 to 12.
- Day of week: 0 to 7, where both 0 and 7 mean Sunday and 1 is Monday.
Syntax
| Symbol | Meaning | Example |
|---|---|---|
| * | Every value | * in the hour field means every hour. |
| , | A list | 1,15 means the 1st and the 15th. |
| - | A range | 1-5 in day of week means Monday to Friday. |
| / | A step | */10 in minutes means every 10 minutes. |
Things that surprise people
- If both day of month and day of week are restricted, cron runs when either matches, not both.
- The schedule runs in the time zone of the machine that runs cron, often UTC on servers. The next runs shown here use your browser's time zone.
- Some systems accept extras such as @daily, names like MON, or a sixth field for seconds. This tool covers the five-field numeric form that works nearly everywhere.
Know when a job did not run
A correct schedule does not prove that the job ran. The machine may be off, cron may be misconfigured or the script may fail halfway. Use a push monitor in Uptimecat: your job calls a URL when it finishes, and you get an alert if the call does not arrive in time. See cron job monitoring.
Add a heartbeat to a cron line
# every day at 03:30
30 3 * * * /usr/local/bin/backup.sh && curl -fsS https://your-push-url-from-the-dashboardReading a few examples
The expression 0 */6 * * * runs at minute zero every six hours. The expression 15 2 * * 1 runs at 02:15 each Monday. The expression 0 8-18 * * 1-5 runs on the hour from 08:00 to 18:00 on weekdays. Paste your own into the fields to see the next runs, and check that the first one is when you expect it.
Frequently asked questions
Why does my job run at a different hour?
Time zones. Compare the server's zone with the one you expect.
How do I run every 90 minutes?
Standard cron cannot do it in one line, because steps restart each hour. Use two lines, or a timer in your job system.
Is the next run list exact?
It follows the standard rules for the five fields, including the either-or rule for days. Daylight saving changes can shift a run on your own system.
Build an expression
Related
Open the dashboard
Sign in with your Google account to add a monitor and pick an alert channel. Access is currently limited to Moruk accounts; open sign-up is not available yet.