Crontab examples
Every schedule here is described by the same parser the generator uses. Open one to preview its runs, or copy it straight into crontab -e.
Minutes
| Expression | Schedule | Meaning |
|---|---|---|
* * * * * | Every minute | Every minute. |
*/2 * * * * | Every 2 minutes | Every 2 minutes. |
*/5 * * * * | Every 5 minutes | Every 5 minutes. |
*/10 * * * * | Every 10 minutes | Every 10 minutes. |
*/15 * * * * | Every 15 minutes | Every 15 minutes. |
*/20 * * * * | Every 20 minutes | Every 20 minutes. |
*/30 * * * * | Every 30 minutes | Every 30 minutes. |
Hours
| Expression | Schedule | Meaning |
|---|---|---|
0 * * * * | Every hour | Every hour, on the hour. |
30 * * * * | Every hour at :30 | At minute 30 past every hour. |
0 */2 * * * | Every 2 hours | Every 2 hours, on the hour. |
0 */3 * * * | Every 3 hours | Every 3 hours, on the hour. |
0 */4 * * * | Every 4 hours | Every 4 hours, on the hour. |
0 */6 * * * | Every 6 hours | Every 6 hours, on the hour. |
0 */12 * * * | Every 12 hours | Every 12 hours, on the hour. |
Days
| Expression | Schedule | Meaning |
|---|---|---|
0 0 * * * | Every day at midnight | At 00:00, every day. |
0 8 * * * | Every day at 08:00 | At 08:00, every day. |
0 12 * * * | Every day at noon | At 12:00, every day. |
30 2 * * * | Nightly at 02:30 | At 02:30, every day. |
0 9,17 * * * | Twice a day (09:00, 17:00) | At 09:00 and 17:00, every day. |
Weeks
| Expression | Schedule | Meaning |
|---|---|---|
0 0 * * 0 | Every Sunday at midnight | At 00:00, on Sunday. |
0 9 * * 1 | Every Monday at 09:00 | At 09:00, on Monday. |
0 17 * * 5 | Every Friday at 17:00 | At 17:00, on Friday. |
0 10 * * 6,0 | Weekends at 10:00 | At 10:00, on weekends. |
Months & years
| Expression | Schedule | Meaning |
|---|---|---|
0 0 1 * * | First day of every month | At 00:00, on the 1st of the month. |
0 0 15 * * | 15th of every month | At 00:00, on the 15th of the month. |
0 0 1 */3 * | Every quarter (1st, 00:00) | At 00:00, on the 1st of the month, every 3 months (January, April, July and October). |
0 0 1 1 * | Once a year (1 January) | At 00:00, on the 1st of the month, in January. |
Business
| Expression | Schedule | Meaning |
|---|---|---|
0 9 * * 1-5 | Weekdays at 09:00 | At 09:00, on weekdays (Monday through Friday). |
*/15 9-17 * * 1-5 | Every 15 min, office hours | Every 15 minutes between 09:00 and 17:59, on weekdays (Monday through Friday). |
0 9-17 * * 1-5 | Hourly, 09–17, weekdays | Every hour at :00, from 09:00 through 17:00, on weekdays (Monday through Friday). |
0 18 * * 1-5 | Weekdays at 18:00 (end of day) | At 18:00, on weekdays (Monday through Friday). |
0 3 * * 0 | Weekly maintenance, Sun 03:00 | At 03:00, on Sunday. |
More schedules and full crontab lines
| Line | What it does |
|---|---|
0 0 * * 1-5 | Weekdays at midnight |
0 22 * * 1-5 | Weekdays at 22:00 |
0 0 1,15 * * | Twice a month, 1st and 15th |
0 6 * * 6 | Saturday morning at 06:00 |
5 4 * * 0 | Sunday 04:05 |
0 0 1 1,4,7,10 * | First day of each quarter |
*/10 * * * * /usr/bin/flock -n /tmp/sync.lock /opt/sync.sh | Every 10 minutes, skipping a run if the last one is still going |
0 3 * * * /usr/bin/find /tmp -type f -mtime +7 -delete | Nightly clean-up of week-old temp files |
0 2 * * * pg_dump mydb | gzip > /backups/db-$(date +\%F).sql.gz | Nightly database dump (note the escaped %) |
@reboot /home/app/start.sh >> /var/log/app.log 2>&1 | Start an app when the machine boots |