Linux Cron
Learn standard Unix/Linux cron from first principles: crontab syntax, environment issues, logging, debugging, and safe production jobs.
What you will learn
- Read and write standard five-field cron expressions.
- Install and inspect user crontabs safely.
- Debug PATH, environment, permissions, and logging problems.
- Design cron jobs that are observable and safe to retry.
Course lessons
1. Cron and crontab fundamentals
Understand what cron does and how crontab entries are evaluated.
Exercise: Create expressions for every 5 minutes, every hour, and every day at midnight.
2. Operators and field behavior
Use stars, steps, lists, ranges, weekday aliases, and month aliases confidently.
Exercise: Build a weekday 09:00 schedule and validate it in Cron Explainer.
3. Cron environment and shell scripts
Avoid the classic 'works manually but not in cron' failure mode.
Exercise: Write a cron-safe shell command that redirects stdout and stderr to a log file.
4. Production logging and monitoring
Make scheduled jobs debuggable after they fail at 03:00.
Exercise: Add a heartbeat call and failure log to a backup cron job.
5. Safe retries and overlap prevention
Protect jobs that can run longer than their schedule interval.
Exercise: Design a locking strategy for a job scheduled every 15 minutes.