Back to lessons

Hosting Operations

Find System Cron Files Fast

System cron jobs can live in /etc/cron.d and periodic directories, so checking only crontab -l misses them.

Command

find /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly -maxdepth 1 -type f -print 2>/dev/null | sort

What changed

Nothing changes. The command lists system cron files in stable order.

Danger

safe

When to use it

Use when a scheduled task runs as root, a service user, or a package job rather than the current user.

When not to use it

Do not assume every listed file is executable or valid under run-parts naming rules.

Undo or recovery

No undo needed because the command is read-only.

Expected output

Sorted paths under /etc/cron.d and periodic cron directories.

demo script

Disposable terminal steps

  1. find /etc/cron.d /etc/cron.daily -maxdepth 1 -type f -print | sort
  2. find /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly -maxdepth 1 -type f -print 2>/dev/null | sort

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find /etc/cron.d /etc/cron.daily -maxdepth 1 -type f -print | sort
/etc/cron.d/app-heartbeat
/etc/cron.d/db-backup
/etc/cron.d/e2scrub_all
/etc/cron.daily/apt-compat
/etc/cron.daily/db.backup
/etc/cron.daily/dpkg
/etc/cron.daily/logrotate
::exit-code::0
$ find /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly -maxdepth 1 -type f -print 2>/dev/null | sort
/etc/cron.d/app-heartbeat
/etc/cron.d/db-backup
/etc/cron.d/e2scrub_all
/etc/cron.daily/apt-compat
/etc/cron.daily/db.backup
/etc/cron.daily/dpkg
/etc/cron.daily/logrotate
::exit-code::0

YouTube Short

Cron is bigger than crontab.

If the user crontab is empty, do not stop. System cron files can still launch backups, cleanup, and package jobs.

LinkedIn hook

A job can be nowhere in your crontab and still run every night.

Question: How often do you find production jobs hiding outside user crontabs?

experiments

A/B tests to run

Metric: linkedin_comment_rate

A: The job was not in crontab -l.

B: Cron has more hiding places than people remember.