Where are system-wide cron jobs configured?
System-wide jobs live in /etc/crontab and /etc/cron.d/, plus the drop-in dirs /etc/cron.{hourly,daily,weekly,monthly}/ where you just place a script.
There are two styles. The table style (/etc/crontab, /etc/cron.d/*) uses the familiar five time fields but adds a sixth field — the user to run as (system crontabs aren't tied to one person). The drop-in style is even simpler: drop an executable script into /etc/cron.daily/ and it runs daily, no time syntax to write. /etc/cron.d/ is preferred for packages because each app gets its own file instead of everyone editing one shared /etc/crontab.
| Location | Purpose |
|---|---|
/etc/crontab |
Main system crontab |
/etc/cron.d/ |
Drop-in cron files |
/etc/cron.hourly/ |
Scripts run hourly |
/etc/cron.daily/ |
Scripts run daily |
/etc/cron.weekly/ |
Scripts run weekly |
/etc/cron.monthly/ |
Scripts run monthly |
System crontab has extra field (user):
MIN HOUR DAY MONTH WEEKDAY USER command
Example /etc/crontab:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# Run daily backup as root
0 2 * * * root /usr/local/bin/backup.sh
Drop-in files in /etc/cron.d/:
- Separate files per application
- Same format as /etc/crontab
- Easier to manage than one big file
Tip: Put scripts in /etc/cron.daily/ for simple daily jobs - no time format needed!