Cron syntax, explained simply

The five fields of a cron expression with the handful of patterns you will actually use.

1 min readDiese Anleitung auf Deutsch lesen

For the usual cases you do not need cron at all: Daily, Weekdays and Every few hours are usually enough. You only need cron under Custom (cron).

A cron time is five fields: minute hour day-of-month month day-of-week. * means "every".

ExpressionMeaning
0 4 * * *every day at 04:00
30 3 * * *every day at 03:30
0 */6 * * *every 6 hours (00:00, 06:00, 12:00, 18:00)
*/30 * * * *every 30 minutes
0 4 * * 1Mondays at 04:00 (0 or 7 = Sunday, 1 = Monday ... 6 = Saturday)
0 14 * * 4Thursdays at 14:00 (Rust wipe day)
0 4 1 * *the 1st of every month at 04:00
0 4 * * 1,4Mondays and Thursdays at 04:00

Under Custom (cron) the server management shows the five fields as separate boxes: put 0 in minute, 4 in hour, * in the rest for a daily 04:00 run.

Mistakes

  • 0 0 * * * is midnight, which is fine, but * 4 * * * runs every minute between 04:00 and 04:59. Always set the minute.
  • Day-of-month and day-of-week both set (0 4 1 * 1) means "1st of month or Monday" in cron, which surprises everyone. Use one or the other.
Still stuck?

Kowalski, the assistant in your dashboard, reads your server's log and fixes most things on request. For everything else there is the ticket system.