crontab Day-of-Week Specification Can Use English Abbreviations Like SUN-SAT in Addition to Numbers 1-7
I recently learned that crontab day-of-week specification can use English abbreviations like SUN-SAT in addition to numbers 1-7, so I’d like to share this.
What I often struggled with in crontab notation was specifying “day of week.”
I often had to look up “When I specify number 1, is that Sunday or Monday?” and during my research, I discovered that you can use English abbreviations like SUN.
<td>0-59</td>
<td>, - * /</td>
</tr>
<tr>
<td>Minutes</td>
<td>YES</td>
<td>0-59</td>
<td>, - * /</td>
</tr>
<tr>
<td>Hours</td>
<td>YES</td>
<td>0-23</td>
<td>, - * /</td>
</tr>
<tr>
<td>Day of month</td>
<td>YES</td>
<td>1-31</td>
<td>, - * ? / L W<br clear="all">
</td>
</tr>
<tr>
<td>Month</td>
<td>YES</td>
<td>1-12 or JAN-DEC</td>
<td>, - * /</td>
</tr>
<tr>
<td>Day of week</td>
<td>YES</td>
<td>1-7 or SUN-SAT</td>
<td>, - * ? / L #</td>
</tr>
<tr>
<td>Year</td>
<td>NO</td>
<td>empty, 1970-2099</td>
<td>, - * /</td>
</tr>
</tbody>
Field Name | Mandatory | Allowed Values | Allowed Special Characters |
---|---|---|---|
Seconds | YES |
For “Month,” it seems you can also use English abbreviations like JAN-DEC, but I think it’s easier to understand if you stick with numeric notation for this.
That’s all from the Gemba.