Scheduling guides

Build and check a weekday morning cron schedule

·

A task that runs twice each morning needs both a minute selection and an hour selection. Writing those separately makes the boundary at the end of the morning easier to check.

Crontab Expression Builder

Build a two-hour morning window

Set Minute to 5,35 and Hour to 9-10. Leave Day of month and Month as * and enter MON-FRI for Day of week. Build the schedule to obtain 5,35 9-10 * * MON-FRI.

OpenBSD crontab field reference

Check the next Monday

Use UTC and a start of 5 May 2024 at 00:00. The first four matches are Monday 6 May at 09:05, 09:35, 10:05 and 10:35. The fifth is Tuesday at 09:05. Switching the weekday field to SUN changes which calendar days contribute times.

Choose between calendar spacing and an elapsed interval

For an hourly job at minute 15, enter 15 in the minute field and leave the hour unrestricted. At 09:59 the next top-of-schedule occurrence is 10:15. Restarting an application at 10:06 does not shift the expression to 11:06.

If a requirement says to wait an hour after the previous job finishes, a calendar expression alone cannot represent that dependency. Clarify the required behavior before translating it into fixed clock times.

Common questions

Why does a Friday-or-the-thirteenth preset use two day fields?

In this dialect, restricting both fields includes each Friday plus the thirteenth of each month. A Friday the thirteenth appears once.

Does the downloaded file include a shell command?

The file contains the five-field expression and a final newline. The page can be used to plan a schedule without supplying command text.

Sources

Put it into practice.

Related guides