NadirTools

Cron Syntax Reference & Operator Guide

1 min read

Master the five-field cron system, special characters, and syntax formatting rules.

The Five Fields of Cron

A standard cron expression consists of five space-separated fields representing the time interval of execution:

* * * * * | | | | | | | | | +----- Day of week (0 - 6) (Sunday=0) | | | +--------- Month (1 - 12) | | +------------- Day of month (1 - 31) | +----------------- Hour (0 - 23) +--------------------- Minute (0 - 59) ```

Special Operators

- `*` (Asterisk): Matches any value in the field (e.g., every minute).

- `,` (Comma): Separates a list of values (e.g., `1,5` in the hour field means 1:00 AM and 5:00 AM).

- `-` (Hyphen): Defines a range of values (e.g., `1-5` in the day of week field means Monday through Friday).

- `/` (Slash): Specifies increments/steps (e.g., `*/15` in the minute field means every 15 minutes).