25+ Crontab Examples You Can Copy and Paste
Looking for crontab examples you can copy, paste, and trust? You are in the right place. Below is a quick-reference table of the most common cron schedules, followed by grouped examples with plain-English explanations — so you understand exactly what each line does before it lands in your crontab.
To add any of these, open your crontab with crontab -e, paste the line, replace the command with your own, and save.
Quick Reference: The Most Common Crontab Examples
| Schedule | Cron expression |
|---|---|
| Every minute | * * * * * |
| Every 5 minutes | */5 * * * * |
| Every 15 minutes | */15 * * * * |
| Every 30 minutes | */30 * * * * |
| Every hour | 0 * * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 6 a.m. | 0 6 * * * |
| Every Sunday at midnight | 0 0 * * 0 |
| Weekdays at 9 a.m. | 0 9 * * 1-5 |
| First of the month | 0 0 1 * * |
| At system startup | @reboot |
Bookmark this table — it covers 90% of real-world cron schedule examples. Now let's walk through each group with working commands.
Minute-Based Crontab Examples
Every minute
* * * * * /home/user/scripts/check.sh
All five fields are wildcards, so the job fires once per minute. Use sparingly — that is 1,440 runs per day.
Every 5 minutes
*/5 * * * * /home/user/scripts/sync.sh
The */5 step value fires at minutes 0, 5, 10, and so on.
Every 10 minutes during business hours
*/10 9-17 * * 1-5 /home/user/scripts/poll.sh
Combines a step (*/10), an hour range (9-17), and a weekday range (1-5).
Hourly and Daily Crontab Examples
Top of every hour
0 * * * * /home/user/scripts/hourly-report.sh
Every 6 hours
0 */6 * * * /home/user/scripts/cleanup.sh
Runs at 00:00, 06:00, 12:00, and 18:00.
Cron every day at midnight
0 0 * * * /home/user/scripts/daily-backup.sh
Every day at 11:30 p.m.
30 23 * * * /home/user/scripts/end-of-day.sh
Remember: cron uses 24-hour time, so 23 means 11 p.m.
Twice a day (8 a.m. and 8 p.m.)
0 8,20 * * * /home/user/scripts/twice-daily.sh
The comma lists two specific hours.
Weekly and Monthly Crontab Examples
Every Monday at 7 a.m.
0 7 * * 1 /home/user/scripts/weekly-summary.sh
Day-of-week 1 is Monday (0 and 7 are both Sunday).
Weekends only, at noon
0 12 * * 6,0 /home/user/scripts/weekend.sh
First day of every month
0 0 1 * * /home/user/scripts/monthly-invoice.sh
The 1st and 15th at 3:30 a.m.
30 3 1,15 * * /home/user/scripts/payroll.sh
Once a year (January 1st)
0 0 1 1 * /home/user/scripts/yearly-archive.sh
Special Shortcut Examples
Cron's @ shortcuts replace all five fields:
@reboot /home/user/scripts/start-services.sh # once at boot
@hourly /home/user/scripts/rotate.sh # same as 0 * * * *
@daily /home/user/scripts/backup.sh # same as 0 0 * * *
@weekly /home/user/scripts/report.sh # same as 0 0 * * 0
@monthly /home/user/scripts/billing.sh # same as 0 0 1 * *
@reboot is the odd one out — it runs once when the system starts, which is handy for launching lightweight services without writing a systemd unit.
Real-World Common Cron Jobs
These crontab entry examples show complete, production-style lines with logging:
# Nightly database dump at 2:15 a.m., with output logged
15 2 * * * /usr/bin/mysqldump -u backup mydb > /var/backups/mydb.sql 2>> /var/log/db-backup.log
# Clear files older than 7 days from /tmp/app every Sunday
0 4 * * 0 /usr/bin/find /tmp/app -type f -mtime +7 -delete
# Renew TLS certificates twice daily (certbot recommends this)
0 0,12 * * * /usr/bin/certbot renew --quiet
# Ping a health endpoint every 5 minutes and log failures
*/5 * * * * /usr/bin/curl -fsS https://example.com/health >> /var/log/health.log 2>&1
Notice the pattern: absolute paths for every binary, and output redirected somewhere you can read it later.
Environment variables in the crontab
You can set variables above your entries, and they apply to every job below them:
MAILTO=admin@example.com
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash
0 3 * * * backup.sh # now found via the PATH set above
MAILTO routes any job output to a real address, PATH saves you from typing full paths on every line, and SHELL switches from the default /bin/sh if your commands rely on bash features.
Common Mistakes to Avoid
- Relative paths. Cron's PATH is minimal.
mysqldumpmay fail where/usr/bin/mysqldumpsucceeds. - Both day fields set.
0 0 13 * 5runs on the 13th and every Friday — the two day fields are OR'd, not AND'd. - No output handling. Without redirection, output is mailed to the local user or lost. Add
>> /path/to/log 2>&1. - Expecting
*/5to mean "5 minutes after the last run." Steps are clock-aligned: 0, 5, 10, not "whenever plus five." - Editing
/etc/crontablike a user crontab. The system crontab needs a sixth field — the username — before the command.
Best Practices
- Keep a
#comment above every entry explaining what it does. - Test each command in your shell before scheduling it.
- Verify what cron actually has with
crontab -l. - Use crontab.guru to double-check any expression you are unsure about.
- Stagger heavy jobs (e.g., 2:07 a.m. instead of 2:00) so they do not pile up with everything else scheduled on the hour.
Conclusion
These crontab examples cover the schedules that come up again and again: step values for intervals, ranges for business hours, commas for specific times, and @ shortcuts for readability. Copy the one closest to your need, swap in your command with absolute paths, and redirect the output to a log.
Want to understand why these expressions work the way they do? Read our full cron syntax guide next, or learn how to set up your first cron job from scratch.
Frequently Asked Questions
How do I list my current crontab entries?
Run crontab -l to print your user's crontab to the terminal. To see another user's jobs (as root), use crontab -l -u username.
How do I run a cron job every day at a specific time?
Set the minute and hour fields and leave the rest as wildcards. For 6:30 a.m. daily: 30 6 * * * /path/to/command.
What is the crontab example for every 30 minutes?
Use */30 * * * * /path/to/command. It runs at minute 0 and minute 30 of every hour — equivalent to 0,30 * * * *.
Can I put multiple commands in one crontab line?
Yes — chain them with && (run the next only if the previous succeeded) or ; (run regardless): 0 2 * * * /path/first.sh && /path/second.sh.
Need the expression itself? Build and test any cron schedule in our free visual generator — with live upcoming-run previews in Unix and Quartz formats.
Related guides
References
- man7.org — crontab(5) manual page — canonical syntax reference
- crontab.guru — verify any expression before saving it