DEV Community

Hive80-lab
Hive80-lab

Posted on

We deleted 60% of our cron jobs in one week — the audit script that found the zombies

Every team has cron zombies: jobs that run every night, succeed silently, and produce nothing anyone reads. Ours had 214 scheduled jobs. After one week of auditing, we deleted 131 — and nothing broke. Not one pager, not one "hey where did that report go."

Here's the uncomfortable part: nobody missed them. Not one.

The audit, in four questions

For every scheduled job, we answered:

  1. Who consumes the output? A name, not a team. "The data team" means nobody.
  2. When did a human last act on it? Logs show opens, downloads, or tickets — pick one signal.
  3. What does it cost if it silently fails? If the answer is "nothing, probably," that's a zombie telling you itself.
  4. Is it duplicated? Three teams had overlapping backup-verify jobs. Two were redundant.

Any job failing two or more questions went to the kill list. We didn't delete immediately — we disabled, waited two weeks, then deleted. That's the whole governance model.

The script that finds the zombies

The core is embarrassingly simple: pull your crontab (or scheduler export), then check the job's log freshness and output destination:

# List every cron job with its last log-modified date
for cmd in $(crontab -l | grep -v '^#' | awk '{print $NF}'); do
  echo "JOB: $cmd"
done

# The real signal: outputs nobody touched
find /var/reports /var/exports -type f -mtime +30 |   xargs -I{} sh -c 'echo "STALE: {} ($(stat -c %y {} | cut -d. -f1))"'
Enter fullscreen mode Exit fullscreen mode

A job whose output hasn't been opened in 90 days is dead weight. A job whose log hasn't rotated in 90 days is a zombie and a blind spot — when it eventually fails, nobody will notice for months.

What we kept (and why it surprised us)

The survivors clustered into three groups: restore-verification (runs weekly, output = pass/fail a human reads), alert dedup (5-minute loop feeding our pager), and certificate expiry checks. Everything else — nightly CSV exports to a share nobody mounts, "summary" emails to a distribution list from 2021, a report generator for a project that shipped two years ago — gone.

One caveat: don't audit during a freeze. Get the owner's sign-off in writing for each kill, and keep the crontab in git so any deletion is a revert, not an archaeology project.

The week after the cleanup, our nightly batch window dropped from 4 hours to 40 minutes. Fewer jobs, less contention, faster runs. Deleting work is the cheapest performance optimization there is.


If you want the whole drill set — runbooks, backup tests, alert budgets, handoff forms — they're in the Ops Starter Kit ($29). Every kit in one pack: Ops Mega Bundle ($49, 5 kits in one download). And if you'd rather have an always-on ops desk run the drills for you, that's Agent-Ops 24/7.

Top comments (0)