Interview Prep/Shell Scripting/cron and systemd timers

What is the difference between a user crontab, `/etc/crontab`, `/etc/cron.d/` and `/etc/cron.daily/`?

IntermediateConceptcron and systemd timers
Answer
  • User crontab (crontab -e, stored in /var/spool/cron/): five time fields + command, runs as that user.
  • /etc/crontab and /etc/cron.d/*: system files with an extra user field between the time and the command. Files in cron.d are what packages and config management should drop.
  • /etc/cron.{hourly,daily,weekly,monthly}/: executable scripts run by run-parts (via anacron on many distros). On Debian, run-parts ignores filenames containing dots, so backup.sh silently never runs; name it backup.
# /etc/cron.d/opskit
*/5 * * * * opskit /opt/opskit/bin/opskit-health -q
All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on cron and systemd timers