Cron Syntax

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


Note: Day-of-month and Day-of-week are treated as OR.

#1

Run a command every minute

* * * * *
/path/to/command
#2

Run a command every 5 minutes

*/5 * * * *
/path/to/command
#3

Run a command at 2:30 AM every day

30 2 * * *
/path/to/command
#4

Run a command at 4:00 AM every Sunday

0 4 * * 0
/path/to/command
#5

Run a command at 5:00 PM on the 1st day of every month

0 17 1 * *
/path/to/command
#6

Run a command every day at 12:00 noon

0 12 * * *
/path/to/command
#7

Run a command every hour between 9:00 AM and 5:00 PM

0 9-17 * * *
/path/to/command
#8

Run a command at midnight every day

0 0 * * *
/path/to/command
#9

Run a command on weekdays at 8:00 AM

0 8 * * 1-5
/path/to/command
#10

Run a command on the last day of every month

0 0 28-31 * *
[ "$(date +\%d -d tomorrow)" == "01" ] && /path/to/command
#11

Run a command every year on January 1st at midnight

0 0 1 1 *
/path/to/command
#12

Run a command every 15 minutes between 6:00 AM and 6:00 PM

*/15 6-18 * * *
/path/to/command
#13

Run a command every 30 seconds (using two cron jobs)

* * * * *
/path/to/command
* * * * *
sleep 30; /path/to/command
#14

Run a command on the first Monday of every month

0 0 1-7 * *
[ "$(date +\%u)" == "1" ] && /path/to/command
#15

Run a command every day at 6:00 AM and 6:00 PM

0 6,18 * * *
/path/to/command
#16

Run a command only in January and July at midnight

0 0 * 1,7 *
/path/to/command
#17

Run a command every 10 days

0 0 */10 * *
/path/to/command
#18

Run a command every two hours

0 */2 * * *
/path/to/command
#19

Run a command at 4:30 PM every Friday

30 16 * * 5
/path/to/command
#20

Run a command every 1st and 15th of the month

0 0 1,15 * *
/path/to/command