Cron Job Stopped Running Silently? How to Monitor Cron Jobs

Cron jobs and scheduled tasks fail without telling anyone. Add heartbeat pings so you get an alert when a backup, invoice run or email job does not finish on time.

A cron job that stops running makes no noise, because a job that never starts cannot report an error. The fix is heartbeat monitoring, also called a dead man's switch: the job pings a URL when it finishes successfully, and a monitor alerts you when the ping is late or missing. It takes about ten minutes to set up and catches failed scripts, a stopped scheduler, a broken deploy and jobs that run but do nothing.

This works for Linux crontab, Laravel, Django with Celery beat, Node.js schedulers, Kubernetes CronJobs, GitHub Actions schedules and any other timer. The idea is the same for all of them.

Step 1: Understand why scheduled jobs fail quietly

Normal monitoring watches things that are running: a request fails, an error is logged, a page goes down. A scheduled job is the opposite. When it breaks, nothing happens, and no one sees nothing.

Common ways a job stops without an alert:

  • The script crashes and the crash email goes nowhere (cron mail needs a working mail setup).
  • The server reboots or the scheduler process dies and is not restarted.
  • A deploy changes a path, an environment variable or a dependency, so the command fails every time.
  • The job runs, hits an API limit or an empty query, and exits with success while doing nothing.
  • The job takes longer than its interval and overlaps with itself or gets killed.

An uptime monitor cannot help here, because there is no URL to check. That is why the signal has to come from the job itself.

Step 2: Create a heartbeat monitor

Use a service that gives you a unique ping URL and an expected schedule. Healthchecks.io, Cronitor and Better Stack all work this way, and many uptime tools now include it. Create a check with two settings:

  • Period: how often the job should run (every hour, every night at 02:00).
  • Grace time: how late a ping may be before you get alerted. Set it to a bit more than the normal run time.

You get a URL such as https://hc-ping.com/<your-uuid>. Treat it as a secret, since anyone with it can send fake pings. Pick the alert channel (email, Slack, phone) now, not during an outage.

Step 3: Ping only on success

For a crontab line, chain the ping with && so it fires only if the command exits with code 0:

0 2 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://hc-ping.com/YOUR-UUID > /dev/null

-fsS makes curl fail on HTTP errors, -m 10 stops it hanging, and --retry 3 covers a short network blip. If the backup fails, no ping is sent, and the monitor alerts after the grace time.

For shell scripts with several steps, add set -euo pipefail at the top so any failing step stops the script before the final ping.

Step 4: Ping from inside your app code

If the job is a function in your app, ping at the end of it. Node.js:

async function nightlyInvoices() {
  const invoices = await createInvoices();
  await sendInvoiceEmails(invoices);

  // reached only if nothing above threw
  await fetch("https://hc-ping.com/YOUR-UUID", {
    signal: AbortSignal.timeout(10_000),
  }).catch(() => {}); // a monitoring hiccup must not fail the job
}

Python:

import requests

def nightly_invoices():
    create_and_send_invoices()
    try:
        requests.get("https://hc-ping.com/YOUR-UUID", timeout=10)
    except requests.RequestException:
        pass

Laravel has this built into the scheduler:

$schedule->command('invoices:send')
    ->dailyAt('02:00')
    ->pingOnSuccess('https://hc-ping.com/YOUR-UUID');

The .catch and try/except matter. If the monitor is down, your real job should still finish.

Step 5: Add start and failure signals

A success-only ping tells you the job is late only after the grace time ends. Two extras make alerts faster and more useful:

  • Start ping: send one when the job begins. The monitor can then tell "never started" from "started and hung", and it can measure how long runs take.
  • Failure ping: send one when you catch an error, so you are alerted at once and not after the window. Healthchecks.io supports this by appending /fail to the ping URL, and /start for the start signal (Healthchecks.io docs). Check your provider's docs for the exact form.
curl -fsS -m 10 https://hc-ping.com/YOUR-UUID/start
/usr/local/bin/backup.sh \
  && curl -fsS -m 10 https://hc-ping.com/YOUR-UUID \
  || curl -fsS -m 10 https://hc-ping.com/YOUR-UUID/fail

Step 6: Catch jobs that run but do nothing

The worst case is a job that exits 0 after doing no work. A query returns zero rows because a filter broke, or an API key expired and the code swallowed the error. Make the ping depend on the result:

const sent = await sendReminderEmails();
if (sent === 0 && expectedToSend) {
  await ping("/fail"); // ran, but did nothing
  return;
}
await ping();

For jobs that should always produce something (a backup file, a daily report), check the output exists and is not empty before you ping.

Step 7: Watch the monitor and the scheduler

Two gaps remain:

  • The monitoring service itself. If it is down, you get no alerts. Pick a provider with a public status page and keep the alert email working.
  • The scheduler process. For Laravel, schedule:run must itself be called every minute by cron. For queue workers and Celery beat, use a process manager such as systemd or a container restart policy. A heartbeat on a job that runs every few minutes is the quickest way to notice the scheduler is dead.

Also write down every scheduled job you have: what it does, how often, and who gets the alert. Most teams find one or two jobs nobody remembers. If you host on Vercel, also read Vercel cron job not running, and for queue workers see Laravel queue jobs not processing.

How Relia Helps

Heartbeats tell you a job did not finish. They do not tell you why. When the job calls your own API or database, Relia watches those parts of the live product. It can show the failing request, the slow query or the deploy behind it as one incident in plain words, and gives a fix plan with the file and line when there is a stack trace. Relia also runs uptime monitors and checks of key pages and offers a public status page. Use a heartbeat tool for the "it never ran" signal and Relia for the "what broke" part. Try the live demo.

FAQ

How do I know if a cron job is running?

Log a line at start and end, and ping a heartbeat URL on success. Logs show what happened. The heartbeat alerts you when nothing happens.

Why did my cron job stop working after a deploy?

Usual causes are a changed path, a missing environment variable (cron runs with a small environment), a new dependency or a different user. Run the exact command as the cron user to reproduce it.

What is a dead man's switch in monitoring?

It is an alert that fires when an expected signal stops arriving. The job sends a regular ping, and silence is the failure.

Can an uptime monitor watch my cron job?

Not directly, because a scheduled job has no URL to check. You can expose a status endpoint that reports the last successful run, but a heartbeat ping is simpler.

What grace time should I use?

Slightly more than the normal run time. If a nightly job takes about ten minutes, a 30 minute grace time avoids false alarms and still alerts you the same morning.

All guides