Crontab Examples
Discover real-world crontab patterns and use cases. Copy, learn, and adapt these examples for your own automation needs.
Every Minute
Basic* * * * */usr/bin/check-status.shRuns every minute of every hour of every day
every minute of every hour every day
Testing, monitoring scripts
Every 5 Minutes
Basic*/5 * * * */usr/bin/monitor.shRuns every 5 minutes
every 5 minutes of every hour every day
Frequent monitoring, log rotation
Every Hour
Basic0 * * * */usr/bin/hourly-report.shRuns at the beginning of every hour
at minute 0 of every hour every day
Hourly reports, cache cleanup
Daily at Midnight
Basic0 0 * * */usr/bin/daily-backup.shRuns once daily at midnight
at minute 0 at 0:00 every day
Daily backups, log archiving
Weekdays at 9 AM
Business0 9 * * 1-5/usr/bin/morning-report.shRuns at 9:00 AM Monday through Friday
at minute 0 at 9:00 from Monday to Friday
Daily reports, team notifications
Business Hours Every 30 Minutes
Business*/30 9-17 * * 1-5/usr/bin/business-check.shRuns every 30 minutes from 9 AM to 5 PM on weekdays
every 30 minutes between 9:00 and 17:00 from Monday to Friday
Status checks during work hours
End of Business Day
Business0 17 * * 1-5/usr/bin/eod-cleanup.shRuns at 5:00 PM Monday through Friday
at minute 0 at 17:00 from Monday to Friday
End-of-day reports, cleanup tasks
Weekly Maintenance
Maintenance0 2 * * 0/usr/bin/weekly-maintenance.shRuns at 2:00 AM every Sunday
at minute 0 at 2:00 on Sunday
Weekly system maintenance, updates
Monthly Cleanup
Maintenance0 3 1 * */usr/bin/monthly-cleanup.shRuns at 3:00 AM on the first day of every month
at minute 0 at 3:00 on the 1st
Monthly log cleanup, archiving
Quarterly Reports
Maintenance0 6 1 1,4,7,10 */usr/bin/quarterly-report.shRuns at 6:00 AM on the first day of quarters
at minute 0 at 6:00 on the 1st in January, April, July, October
Quarterly business reports
Database Backup
Backup0 2 * * */usr/bin/backup-database.shDaily database backup at 2:00 AM
at minute 0 at 2:00 every day
Database backups during low usage
Security Scan
Security0 1 * * 0/usr/bin/security-scan.shWeekly security scan every Sunday at 1:00 AM
at minute 0 at 1:00 on Sunday
System security audits
Log Rotation
Maintenance0 0 * * 0/usr/sbin/logrotate /etc/logrotate.confWeekly log rotation every Sunday at midnight
at minute 0 at 0:00 on Sunday
Prevent log files from growing too large
Complex Schedule
Advanced15,45 */2 * * 1,3,5/usr/bin/complex-monitor.shRuns at 15 and 45 minutes past every 2nd hour on Mon, Wed, Fri
at minutes 15, 45 of every 2 hours on Monday, Wednesday, Friday
Complex monitoring schedules
Peak Hours Monitoring
Advanced*/10 8-12,14-18 * * 1-5/usr/bin/peak-monitor.shEvery 10 minutes during peak business hours
every 10 minutes at 8-12:00, 14-18:00 from Monday to Friday
Intensive monitoring during busy periods
Year-End Processing
Advanced0 0 31 12 */usr/bin/year-end-process.shRuns at midnight on December 31st
at minute 0 at 0:00 on the 31st in December
Annual reports, year-end processing
Pro Tips
Testing Schedules
Always test your cron expressions with shorter intervals first. Use */1 * * * * (every minute) to verify your script works.
Logging Output
Always redirect output to log files:command >> /var/log/cron.log 2>&1to capture both stdout and stderr.
Environment Variables
Cron runs with a minimal environment. Set PATH and other variables at the top of your crontab or within your scripts.