What Is a Cron Job?
A cron job is a scheduled task that runs automatically at a specified time or interval. The name comes from chronos, Greek for time. Cron is built into every Linux server and powers everything from backups to SSL certificate renewals.
The 5-Field Cron Expression
A cron expression has 5 fields separated by spaces:
minute hour day-of-month month day-of-week * * * * *
- minute (0-59) — what minute of the hour
- hour (0-23) — what hour of the day (24-hour, UTC on servers)
- day-of-month (1-31) — which day of the month
- month (1-12 or JAN-DEC) — which month
- day-of-week (0-7 or SUN-SAT, 0 and 7 are both Sunday) — which weekday
Common Examples
0 9 * * 1-5 # Every weekday at 9am */15 * * * * # Every 15 minutes 0 0 1 * * # First of every month at midnight 0 2 * * 0 # Every Sunday at 2am 30 4 1,15 * * # 1st and 15th at 4:30am
Special Characters
*— every value (every minute, every hour, etc),— list (1,15 = 1st and 15th)-— range (1-5 = Monday to Friday)/— step (*/15 = every 15 minutes, 0-23/2 = every 2 hours)L— last (L in day-of-month = last day of month)
Debugging Cron
The #1 cron mistake is timezone confusion. Server cron runs in UTC by default. If you schedule "0 9 * * *" expecting 9am your time, it runs at 9am UTC — which could be 2am your time. Always check date on the server first.
Second mistake: cron jobs have no PATH. Scripts that work when you run them manually may fail in cron because $PATH is different. Always use absolute paths: /usr/bin/python3 /home/myuser/script.py.