#1
Run a command every minute
* * * * *
—
/path/to/command
Extracted commands and schedules
A cron expression has 5 fields (in standard Vixie cron). Each field accepts numbers, ranges, lists, and steps.
| Field | Position | Allowed Values | Examples |
|---|---|---|---|
| Minute | 1st | 0–59 | 0, 15, 30, 45, */5 |
| Hour | 2nd | 0–23 | 0, 8, 12, 18, */2 |
| Day of Month | 3rd | 1–31 | 1, 15, 28, */10 |
| Month | 4th | 1–12 (or names JAN–DEC) | 1, 7, */3, JAN,JUL |
| Day of Week | 5th | 0–7 (0 or 7 = Sunday, or names SUN–SAT) | 1, 5, MON–FRI |
Special characters:
* = any value (wildcard).
Example: * * * * * runs every minute.
, = list of values.
Example: 0 8,16 * * * runs at 8:00 AM and 4:00 PM daily.
- = range of values.
Example: 0 9-17 * * * runs hourly from 9:00 AM through 5:00 PM.
/ = step values.
Example: */15 * * * * runs every 15 minutes (00, 15, 30, 45).
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
[ "$(date +\%d -d tomorrow)" == "01" ] && /path/to/command
/path/to/command
/path/to/command
/path/to/command
sleep 30; /path/to/command
[ "$(date +\%u)" == "1" ] && /path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command
/path/to/command