Crontab Examples

Discover real-world crontab patterns and use cases. Copy, learn, and adapt these examples for your own automation needs.

Every Minute

Basic
Expression
* * * * *
Command
/usr/bin/check-status.sh

Runs every minute of every hour of every day

Human Readable

every minute of every hour every day

Use Case

Testing, monitoring scripts

Every 5 Minutes

Basic
Expression
*/5 * * * *
Command
/usr/bin/monitor.sh

Runs every 5 minutes

Human Readable

every 5 minutes of every hour every day

Use Case

Frequent monitoring, log rotation

Every Hour

Basic
Expression
0 * * * *
Command
/usr/bin/hourly-report.sh

Runs at the beginning of every hour

Human Readable

at minute 0 of every hour every day

Use Case

Hourly reports, cache cleanup

Daily at Midnight

Basic
Expression
0 0 * * *
Command
/usr/bin/daily-backup.sh

Runs once daily at midnight

Human Readable

at minute 0 at 0:00 every day

Use Case

Daily backups, log archiving

Weekdays at 9 AM

Business
Expression
0 9 * * 1-5
Command
/usr/bin/morning-report.sh

Runs at 9:00 AM Monday through Friday

Human Readable

at minute 0 at 9:00 from Monday to Friday

Use Case

Daily reports, team notifications

Business Hours Every 30 Minutes

Business
Expression
*/30 9-17 * * 1-5
Command
/usr/bin/business-check.sh

Runs every 30 minutes from 9 AM to 5 PM on weekdays

Human Readable

every 30 minutes between 9:00 and 17:00 from Monday to Friday

Use Case

Status checks during work hours

End of Business Day

Business
Expression
0 17 * * 1-5
Command
/usr/bin/eod-cleanup.sh

Runs at 5:00 PM Monday through Friday

Human Readable

at minute 0 at 17:00 from Monday to Friday

Use Case

End-of-day reports, cleanup tasks

Weekly Maintenance

Maintenance
Expression
0 2 * * 0
Command
/usr/bin/weekly-maintenance.sh

Runs at 2:00 AM every Sunday

Human Readable

at minute 0 at 2:00 on Sunday

Use Case

Weekly system maintenance, updates

Monthly Cleanup

Maintenance
Expression
0 3 1 * *
Command
/usr/bin/monthly-cleanup.sh

Runs at 3:00 AM on the first day of every month

Human Readable

at minute 0 at 3:00 on the 1st

Use Case

Monthly log cleanup, archiving

Quarterly Reports

Maintenance
Expression
0 6 1 1,4,7,10 *
Command
/usr/bin/quarterly-report.sh

Runs at 6:00 AM on the first day of quarters

Human Readable

at minute 0 at 6:00 on the 1st in January, April, July, October

Use Case

Quarterly business reports

Database Backup

Backup
Expression
0 2 * * *
Command
/usr/bin/backup-database.sh

Daily database backup at 2:00 AM

Human Readable

at minute 0 at 2:00 every day

Use Case

Database backups during low usage

Security Scan

Security
Expression
0 1 * * 0
Command
/usr/bin/security-scan.sh

Weekly security scan every Sunday at 1:00 AM

Human Readable

at minute 0 at 1:00 on Sunday

Use Case

System security audits

Log Rotation

Maintenance
Expression
0 0 * * 0
Command
/usr/sbin/logrotate /etc/logrotate.conf

Weekly log rotation every Sunday at midnight

Human Readable

at minute 0 at 0:00 on Sunday

Use Case

Prevent log files from growing too large

Complex Schedule

Advanced
Expression
15,45 */2 * * 1,3,5
Command
/usr/bin/complex-monitor.sh

Runs at 15 and 45 minutes past every 2nd hour on Mon, Wed, Fri

Human Readable

at minutes 15, 45 of every 2 hours on Monday, Wednesday, Friday

Use Case

Complex monitoring schedules

Peak Hours Monitoring

Advanced
Expression
*/10 8-12,14-18 * * 1-5
Command
/usr/bin/peak-monitor.sh

Every 10 minutes during peak business hours

Human Readable

every 10 minutes at 8-12:00, 14-18:00 from Monday to Friday

Use Case

Intensive monitoring during busy periods

Year-End Processing

Advanced
Expression
0 0 31 12 *
Command
/usr/bin/year-end-process.sh

Runs at midnight on December 31st

Human Readable

at minute 0 at 0:00 on the 31st in December

Use Case

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.