Overview
Cron is a time-based job scheduler for Unix/Linux systems.
Why It Matters
Cron is essential for scheduling regular tasks and automating system maintenance.
Essential Commands
crontab -eEdit current user cron jobs
crontab -lList current user cron schedule
0 2 * * * /usr/bin/backup.shRun script daily at 02:00
*/5 * * * * /usr/bin/php /app/job.phpRun job every 5 minutes
0 0 * * 0 /usr/bin/logrotateRun task weekly on Sunday midnight
MAILTO="[email protected]"Send cron output to email address
Quick Start
Master use crontab -e to edit schedules first
Key Concepts
Use crontab -e to edit schedules
Understand minute, hour, day, month, weekday syntax
Debug cron issues with logs
Pro Tips
- Combine multiple commands for powerful workflows
- Use aliases to speed up your command entry
- Create scripts to automate repetitive tasks
Common Pitfalls to Avoid
- • Forgetting to check the documentation for edge cases
- • Running commands without understanding their full impact
- • Not testing changes in a safe environment first