Configuring cron task schedule
- crontab -e
* * * * * task
Fields | |||||
---|---|---|---|---|---|
* | * | * | * | * | /path/to/task |
minute | hour | day of month | month | day of week | full path to command |
0-59 | 0-23 | 1-31 | 1-12 JAN-DEC | 0-6 SUN-SAT 7 (Non-standard) | can be binary, or any script |
Legend | |
---|---|
option | Description |
* | Any value |
, | Value list separator |
- | Range of values |
/ | Step values |
@yearly | Non-standard |
@annually | Non-standard |
@monthly | Non-standard |
@weekly | Non-standard |
@daily | Non-standard |
@hourly | Non-standard |
@reboot | Non-standard |
Examples | |
---|---|
Schedule | Description |
every minute | * * * * * |
every even minute | */2 * * * * |
every odd minute | 1-59/2 * * * * |
every 10 minutes | */10 * * * * |
every quarter hour | */15 * * * * |
every half hour | */30 * * * * |
every hour at 30 minutes | 30 * * * * |
every hour | 0 * * * * |
every even hour | 0 */2 * * * |
every odd hour | 0 1-23/2 * * * |
every 6 hours | 0 */6 * * * |
every 8 hours | 0 */8 * * * |
every 12 hours | 0 */12 * * * |
every midnight | 0 0 * * * |
every day at 01:00 | 0 1 * * * |
every midnight on sunday | 0 0 * * SUN |
every midnight on monday | 0 0 * * MON |
every midnight on tuesday | 0 0 * * TUE |
every midnight on wednesday | 0 0 * * WED |
every midnight on thursday | 0 0 * * THU |
every midnight on friday | 0 0 * * FRI |
every midnight on saturday | 0 0 * * SAT |
every midnight on weekday | 0 0 * * 1-5 |
every month on first day at midnight | 0 0 1 * * |
every even month on first day at midnight | 0 0 1 */2 * |
every odd month on first day at midnight | 0 0 1 1-12/2 * |
every quarter on first day at midnight | 0 0 1 */3 * |
every 6 months on first day at midnight | 0 0 1 */6 * |
every new year | 0 0 1 1 * |