Pcornel
Linux · Scheduling

/etc/cron.*

Cheat sheet · https://pcornel.dk/topic.php?topic=2827

Back to the Topic

Answer

The /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly directories hold scripts run by run-parts (or anacron) at those intervals; /etc/cron.d holds crontab-format files from packages and admins.

Remember

Scripts in cron.daily etc. must be executable and, on Debian, have names without dots (run-parts skips backup.sh). anacron runs them later if the machine was off. Test which would run with run-parts --test /etc/cron.daily.

First checks

  • run-parts --test /etc/cron.daily — scripts that would run
  • systemctl list-timers --all — systemd timers and next run
  • crontab -l -u <user> — a user's cron jobs
  • ls /etc/cron.d /etc/cron.daily — system cron jobs
  • journalctl -u cron -u crond --since today — cron executions

Verify in this order

script placed in cron.<period> → run-parts/anacron runs the directory at the period → script executes

Where it usually breaks

First mismatch in persistent unit/config/generator → dependency/order graph → systemd state → process/cgroup → socket/resource dependency → journal → consumer check; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2827

Confirmation

Confirm action

Continue?