Skip to content

Cron expressions

Five fields, ranges, steps, lists and names; the expressions the builder cannot make, and two quirks worth knowing.

Runjet accepts standard five-field cron, as most Unix crons read it. It is checked when a job is saved, and whatever cannot be read is refused. The builder on the form is a shortcut to the commonest shapes (scheduling); this page is the whole language.

Five fields

The order of the fields and their ranges. The day of the week starts with Sunday as 0; 7 is also Sunday.

Fields are separated by a space. Each field is either * — any value — or a value, a range, a list or a step from the ranges below.

Ranges

a-b, both bounds included: 9-17 in the hour field is from nine to five, 1-5 in the day-of-week field is Monday to Friday. Months and weekdays may also be written by name, three letters, case-insensitively: MON-FRI, JAN,JUL.

Steps

*/n is every nth value from the start of the range: */15 in minutes is 0, 15, 30, 45. A step can be added to a range too: 9-17/2 is 9, 11, 13, 15, 17. A step knows no starting point other than zero or the start of its range — */7 in the day-of-month field is 1, 8, 15, 22, 29, not every seventh day of the calendar; at the turn of the month the count starts again at one.

Lists

a,b,c — any of those listed: 0 6,18 * * * is at six and at eighteen. An item in a list may itself be a range or a step: 1-5,0 is weekdays and Sunday.

Descriptors

Instead of five fields Runjet also accepts @hourly, @daily (the same as @midnight), @weekly, @monthly and @yearly (@annually), and @every 90m for an interval measured from the scheduler's start — at least a minute, the same grain five fields have; anything shorter is refused. In the job list they appear as written, because the builder does not know them; for legibility, five fields is the better choice.

What the builder cannot do and cron can

ExpressionWhat it means
0 9 * * 1-5at nine, on weekdays only
*/15 9-17 * * 1-5every quarter of an hour during working hours
0 6,18 * * *at six and at eighteen
30 2 1,15 * *on the 1st and the 15th at 02:30
0 0 1 1,4,7,10 *the first day of each quarter, at midnight
0 22 * * SUNon Sunday at 22:00
5 4 * * 0-6/2at 04:05 on Sunday, Tuesday, Thursday and Saturday

Two quirks

Day of month and day of week compose with OR when both are constrained. 0 9 13 * 5 does not run on Friday the 13th; it runs on every 13th and every Friday. That is classic cron's behaviour and Runjet keeps it. For the intersection, leave one field as * and check the other condition in the command.

Daylight saving is evaluated by Runjet in the workspace's timezone: an hour that does not exist on a given day does not arrive, and an hour that happens twice runs the job once. A job that must run every day without exception belongs at an hour the shift never touches — or in a zone that has no shift at all, UTC being the obvious one.