Lesson 18: cron — scheduling tasks
Your production server needs an automated daily log backup — tar czf every night at 2:00, no human involvement. That's exactly what cron does: runs commands on a fixed schedule. crontab -e adds a job, crontab -l lists them, crontab -r deletes everything without confirmation (be careful). Each cron l
cron is like an alarm clock that runs commands instead of ringing. You tell it 'every night at 2:00 run this' — and it does so forever, without you.
- cron
- A daemon that runs commands on a schedule. Always running in the background. No need to start it manually — it runs automatically with the system.
- crontab
- The user's job table. crontab -l lists, crontab -e edits, crontab -r deletes everything without confirmation. Each line = one job.
- cron syntax (5 fields)
- minute hour day-of-month month day-of-week. * = any value. */N = every N units. 0 2 * * * = every night at 2:00. */15 * * * * = every 15 minutes.