Schedule Smith — DevOps

Write cron expressions that run at exactly the times asked: 18 levels of cron ranges, steps, lists and time windows. 18 levels, right in the browser.

What you learn in this game

A cron line schedules a recurring task with five fields: minute hour day-of-month month day-of-week. Each field matches one part of the time, and * means any value. The task runs at a minute when every field matches (the day of the month and the day of the week have a rule of their own; a later level is about it). 30 * * * * = minute 30 of any hour: 07:30, 08:30, and so on.

The step operator */n matches every multiple of n from the start of the field's range. */10 in minutes = 0, 10, 20, 30, 40, 50. */4 in hours = 0, 4, 8, 12, 16, 20. A step is the short way to write an interval that repeats.

The fifth field is the day of the week: 0 Sunday, 1 Monday, up to 6 Saturday, and 7 is Sunday too. A range a-b covers every value from a to b: 2-4 = Tuesday to Thursday. Ranges work in any field (8-12 in hours, 1-15 in days of the month).

A list a,b,c matches several particular values, not necessarily in order. 7,19 in the hour field = exactly 07:00 and 19:00. A list can hold ranges too: 1-5,0 in weekdays.

Cron's special rule: when the day-of-month and day-of-week fields are both restricted (neither is *), the task runs on a day that matches either one, not both. 0 9 15 * 1 = 09:00 on every 15th and every Monday. When one of the two is *, the other alone decides.

A step does not have to follow *. After a range, a-b/n starts at a and moves n at a time up to b: 9-21/3 = 9, 12, 15, 18, 21. */n is really just the full range with a step.