This is the documentation for the development version. There are no official binaries for it; build it from the source code in git. Download links on these pages work only after the release. For the current release, see version 7.0.

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. It is honored only by DCI custom collection schedules (both server-side and agent-side), which evaluate schedules every second. All other consumers — scheduled tasks, active network discovery, and log parser exclusion schedules — match schedules with minute resolution and ignore the seconds field, so a 6-field expression there behaves exactly like the same expression without its 6th field.

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.

Seconds (optional)

0-59

* , - / % L

6th field. Honored only by DCI custom collection schedules; ignored by all other schedule consumers.

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).

%

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. Because the count does not restart every minute, % gives an even interval even when the step does not divide 60. For example, *%45 matches every 45 seconds (12:00:00, 12:00:45, 12:01:30, 12:02:15, …​), while */45 matches seconds 0 and 45 of every minute, leaving alternating gaps of 45 and 15 seconds. For steps that divide 60, such as 30, % and / match the same seconds. Anything before % is ignored, so %45 and *%45 are equivalent.

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). The seconds field takes effect only in DCI custom collection schedules; in other contexts it is ignored.

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: