-
Notifications
You must be signed in to change notification settings - Fork 0
Cron Syntax
This is a quick reference to cron syntax and also shows the options supported by infinit.
# ┌────────────── second (optional)
# │ ┌──────────── minute
# │ │ ┌────────── hour
# │ │ │ ┌──────── day of month
# │ │ │ │ ┌────── month
# │ │ │ │ │ ┌──── day of week
# │ │ │ │ │ │
# │ │ │ │ │ │
# * * * * * *
field | value |
---|---|
second | 0-59 |
minute | 0-59 |
hour | 0-23 |
day of month | 1-31 |
month | 1-12 (or names) |
day of week | 0-7 (or names, 0 or 7 are sunday) |
You may use multiples values separated by comma, the following example runs every minute 1, 2, 4 and 5:
1,2,4,5 * * * *
You may also define a range of values, the following example runs every minute to 1 from 5:
1-5 * * * *
Step values can be used in conjunction with ranges, following a range with '/' and a number. e.g: 1-10/2
that is the same as 2,4,6,8,10
. Steps are also permitted after an asterisk, so if you want to say “every two minutes”, just use */2
. The following example runs a task every two minutes:
*/2 * * * *
For month and week day you also may use names or short names. The following example runs on Sundays of January and September
* * * January,September Sunday
Or with short names, the following example runs on Sundays of January and September
* * * Jan,Sep Sun