Back to lessons

Hosting Operations

Catch Cron Daily Files That Will Be Skipped

run-parts only executes files matching its naming rules, so backup scripts with dots can be ignored.

Command

run-parts --test /etc/cron.daily

What changed

Nothing changes. run-parts prints which files it would run.

Danger

safe

When to use it

Use when a script in cron.daily, cron.hourly, cron.weekly, or cron.monthly does not appear to execute.

When not to use it

Do not use it to run the jobs; --test is only a dry inspection.

Undo or recovery

No undo needed because the command is read-only.

Expected output

A list of periodic cron scripts that pass run-parts selection rules.

demo script

Disposable terminal steps

  1. find /etc/cron.daily -maxdepth 1 -type f -printf '%f\n' | sort
  2. run-parts --test /etc/cron.daily

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find /etc/cron.daily -maxdepth 1 -type f -printf '%f\n' | sort
apt-compat
db.backup
dpkg
logrotate
::exit-code::0
$ run-parts --test /etc/cron.daily
/etc/cron.daily/apt-compat
/etc/cron.daily/dpkg
/etc/cron.daily/logrotate
::exit-code::0

YouTube Short

Why cron.daily skipped it.

The file can exist, be executable, and still be skipped. Test what run-parts would actually run.

LinkedIn hook

A dot in a filename can keep a cron.daily script from running.

Question: Have you ever lost time to a cron.daily filename that run-parts ignored?

experiments

A/B tests to run

Metric: comment_rate

A: A dot can break your cron.daily plan.

B: The script existed. Cron still skipped it.