Back to lessons

Hosting Operations

Find Cron Jobs With No Log Trail

Cron jobs without redirects, mail, or logger calls can fail without leaving an obvious trail.

Command

crontab -l | awk 'NF && $1 !~ /^#/ && $0 !~ /(>>|2>|logger|mail)/ {print}'

What changed

Nothing changes. The command prints active lines that do not appear to capture output.

Danger

safe

When to use it

Use before relying on cron for backups, reports, billing, imports, or cleanup.

When not to use it

Do not treat this as proof the job is broken; it is a prompt to inspect observability.

Undo or recovery

No undo needed because the command is read-only.

Expected output

Cron lines that lack obvious logging or notification patterns.

demo script

Disposable terminal steps

  1. crontab -l
  2. crontab -l | awk 'NF && $1 !~ /^#/ && $0 !~ /(>>|2>|logger|mail)/ {print}'

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ crontab -l
# user crontab for demo
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5 * * * * /usr/local/bin/check-disk >> /var/log/cron-disk.log 2>&1
17 2 * * * /usr/local/bin/backup-db
0 4 * * 0 /usr/local/bin/report-weekly | /usr/bin/mail -s report ops@example.invalid
::exit-code::0
$ crontab -l | awk 'NF && $1 !~ /^#/ && $0 !~ /(>>|2>|logger|mail)/ {print}'
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
17 2 * * * /usr/local/bin/backup-db
::exit-code::0

YouTube Short

Find silent cron jobs.

If cron runs a backup with no redirect and no mail, your first clue may be missing data. Flag silent jobs before they matter.

LinkedIn hook

A silent cron job is a future incident with no witness.

Question: What is your minimum logging standard for cron jobs that touch production data?

experiments

A/B tests to run

Metric: shorts_3_second_hold_rate

A: Silent cron jobs are future incidents.

B: Find cron jobs with no log trail.