Chances are, you have used CRON syntax in the past. If you’re anything like me, you probably used AI to generate the CRON expression that matched your needs.
Sometimes however, I like using my own brain for a change. In that spirit, I did a little refresher on the (traditional Unix) CRON syntax. I’d like to share it with you.
| * | * | * | * | * |
| Minute | Hour | Day (month) | Month | Day (week) |
| 0=7=Sunday |
* = any value
, = value list separator. E.g. 1,5 = the values 1 and 5.
– = range of values. E.g. 2-6 = the values 2, 3, 4, 5 and 6.
/ = step values. E.g. */30 * * * * = every 30 minutes.
Example:
| */30 | 8-20 | * | * | 1-4 |
| Every 30 minutes | From 8:00 till 20:30 | Every day of the month | Every month | Monday till thursday |