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 |
|
|
Hour |
0-23 |
|
Uses 24-hour format. |
Day of month |
1-31 |
|
Not all months have 31 days. Invalid dates are silently skipped. |
Month |
1-12 |
|
1 = January, 12 = December. |
Day of week |
0-7 |
|
0 and 7 both represent Sunday. 1 = Monday, 6 = Saturday. |
Seconds (optional) |
0-59 |
|
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, |
|
Separates items in a list. For example, |
|
Defines an inclusive range. For example, |
|
Specifies a step value after |
|
"Last." On its own, |
|
Specifies the Nth occurrence of a weekday in the month. Used only in the day-of-week field. For example, |
|
Step against absolute time. Used only in the seconds field, in place of |
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 |
|---|---|
|
Every hour at minute 0. |
|
Every 15 minutes. |
|
Every weekday (Monday through Friday) at 08:00. |
|
First day of every month at midnight. |
|
Every Sunday at 02:30. |
|
Last day of every month at midnight. |
|
First Monday of every month at 09:00. |
|
Last Friday of every month at 22:00. |
|
Every 2 hours at minute 0 (00:00, 02:00, 04:00, …). |
|
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 |
|---|---|
|
Every hour at minute 0, second 0. |
|
Every minute at second 30. |
|
Every Sunday at 02:00:00. |
|
Every 10 seconds. |
|
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:
-
Scheduled tasks — script execution, maintenance windows, notifications
-
Active network discovery — scan schedules
-
Data collection — custom collection schedules on DCIs
-
File delivery jobs — recurring file uploads
-
Report generation — report schedules
-
Server configuration variables that accept schedule values (e.g.,
NetworkDiscovery.ActiveDiscovery.Schedule)