Cron Format Reference

NetXMS uses cron expressions to define recurring schedules for tasks such as scheduled scripts, maintenance windows, active network discovery, report generation, and file delivery jobs.

Expression Format

A cron expression consists of five or six space-separated fields:

minute hour day-of-month month day-of-week [seconds]

The seconds field (6th position) is optional. When present, it is always matched — every schedule consumer compares it against the current second. Use it only with DCI custom collection schedules (both server-side and agent-side), which evaluate schedules every second. Other consumers check schedules at coarser, unaligned moments: scheduled tasks and active network discovery check once per minute at an arbitrary second (every 60 seconds from server start, not aligned to second 0), and log parser exclusion schedules are evaluated once per monitoring loop iteration, at a variable cadence with waits of 10-30 seconds. In those contexts a 6-field expression almost never matches and effectively breaks the schedule (issue netxms#3525).

Field Definitions

Field Allowed Values Special Characters Notes

Minute

0-59

* , - / L

Hour

0-23

* , - / L

Uses 24-hour format.

Day of month

1-31

* , - / L

Not all months have 31 days. Invalid dates are silently skipped.

Month

1-12

* , - / L

1 = January, 12 = December.

Day of week

0-7

* , - / L #

0 and 7 both represent Sunday. 1 = Monday, 6 = Saturday. # is available in NetXMS 6.1 and later. The 7→`0` rewrite is applied character-wise to the whole field, so */7 silently becomes step 1 and matches every day — avoid step syntax containing 7 in this field (issue netxms#3525).

Seconds (optional)

0-59

* , - / % L

6th field. Always matched when present; useful only with DCI custom collection schedules — other consumers check schedules at arbitrary seconds, so the expression almost never matches there (issue netxms#3525).

Special Characters

Character Description

*

Matches any value in the field. For example, * in the month field matches every month.

,

Separates items in a list. For example, 1,3,5 in the day-of-week field matches Monday, Wednesday, and Friday.

-

Defines an inclusive range. For example, 9-17 in the hour field matches every hour from 9 through 17.

/

Specifies a step value after or a range — these are the only supported forms. A value matches if it is divisible by the step. For example, /5 in the minute field means every 5 minutes (0, 5, 10, …​). With a range, the step is absolute divisibility, not an offset from the range start: 10-30/5 matches 10, 15, 20, 25, 30, but 10-30/7 matches 14, 21, 28 (multiples of 7 within the range). The Quartz-style form n/step (e.g., 0/30) is not supported and matches only the single value n; use */30 or an explicit list like 0,30 instead.

L

"Last." On its own, L matches the maximum value of its field: the last day of the month in the day-of-month field (28, 29, 30, or 31 depending on the month), Saturday in the day-of-week field, 59 in the minute and seconds fields, 23 in the hour field, and 12 in the month field. Combined with a weekday number in the day-of-week field, nL matches the last occurrence of that weekday in the month — for example, 5L means the last Friday of the month.

#

Specifies the Nth occurrence of a weekday in the month. Used only in the day-of-week field. For example, 2#3 means the third Tuesday of the month (day 2 = Tuesday, occurrence 3). Available in NetXMS 6.1 and later.

%

Step against absolute time. Used only in the seconds field, in place of /: the value tested for divisibility is the absolute UNIX time rather than the second within the minute. For example, *%30 matches whenever the UNIX timestamp is divisible by 30.

Day-of-Week Values

Value Day

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

7

Sunday (alias for 0)

Examples

Expression Description

0 * * * *

Every hour at minute 0.

*/15 * * * *

Every 15 minutes.

0 8 * * 1-5

Every weekday (Monday through Friday) at 08:00.

0 0 1 * *

First day of every month at midnight.

30 2 * * 0

Every Sunday at 02:30.

0 0 L * *

Last day of every month at midnight.

0 9 * * 1#1

First Monday of every month at 09:00.

0 22 * * 5L

Last Friday of every month at 22:00.

0 */2 * * *

Every 2 hours at minute 0 (00:00, 02:00, 04:00, …​).

0 8-17 * * 1-5

Every hour from 08:00 to 17:00 on weekdays (business hours).

6-Field Examples (with seconds)

These examples use the optional seconds field (6th position). Use 6-field expressions only with DCI custom collection schedules. In other contexts the seconds field is still matched, but the schedule is checked at an arbitrary second, so it almost never fires (issue netxms#3525).

Expression Description

0 * * * * 0

Every hour at minute 0, second 0.

* * * * * 30

Every minute at second 30.

0 2 * * 0 0

Every Sunday at 02:00:00.

* * * * * */10

Every 10 seconds.

*/30 9-17 * * 1-5 0

Every 30 minutes during business hours on weekdays, at the top of each half hour.

When the system detects 6 fields, the last field is interpreted as seconds. A 5-field expression always starts with the minute field.

Where Cron Expressions Are Used

Cron expressions appear in the following NetXMS contexts: