一般寫法
# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
另外可用別名
Entry | Description | Equivalent to |
---|---|---|
@yearly (or @annually ) |
Run once a year at midnight of 1 January | 0 0 1 1 * |
@monthly |
Run once a month at midnight of the first day of the month | 0 0 1 * * |
@weekly |
Run once a week at midnight on Sunday morning | 0 0 * * 0 |
@daily (or @midnight ) |
Run once a day at midnight | 0 0 * * * |
@hourly |
Run once an hour at the beginning of the hour | 0 * * * * |
@reboot |
Run at startup | N/A |
其實有年可用,只是它不是必要的欄位
Field | Required | Allowed values | Allowed special characters | Remarks |
---|---|---|---|---|
Minutes | Yes | 0–59 | * , - |
|
Hours | Yes | 0–23 | * , - |
|
Day of month | Yes | 1–31 | * , - ? L W |
? L W only in some implementations |
Month | Yes | 1–12 or JAN–DEC | * , - |
|
Day of week | Yes | 0–6 or SUN–SAT | * , - ? L # |
? L # only in some implementations |
Year | No | 1970–2099 | * , - |
This field is not supported in standard/default implementations.
|
留言