Cron is silent. How do you know the nightly job ran?

Your website can stay healthy while backups and imports stop. Heartbeats track jobs without a public endpoint of their own.

An analogue alarm clock lit by sunlight on a dark surface
Photography: Suhas Hanjar / Unsplash

A nightly import never starts and customers see yesterday's data in the morning. The website is reachable, the server responds and an ordinary HTTP monitor cannot see the problem. Scheduled jobs require evidence that the expected work finished on time. A heartbeat provides that evidence through a signal sent by the job itself.

Track the result, not just the start

If a job sends its signal immediately and then fails, the monitor can show misleading success. Send completion only after verifying the result: a saved export, a successful import or a valid backup. If your system distinguishes start and finish signals, also watch for runs that take unusually long.

A successful exit code may not prove a useful outcome. An import containing no records might be valid or might indicate an unavailable data source. Add an appropriate check for record counts, freshness or the presence of an output file.

Match the deadline to the actual schedule

A daily job needs a daily deadline and reasonable tolerance for delays. Too little tolerance produces false incidents; too much leaves a failure hidden for hours. Distinguish local time from UTC when defining the schedule. Daylight saving changes can affect a job scheduled for a particular hour overnight.

Protect the signal and the job

A heartbeat URL may contain a secret token. Store it as a credential and keep it out of public logs. Sending the signal needs a timeout so an unavailable monitor cannot block completed work. Distinguish a failed notification from a failed job in the local record.

Prevent overlapping runs if the job is not designed for concurrency. After a machine restart, a missed run may need to be recovered. Decide whether rerunning safely handles the same input and make the recovery procedure reflect that decision.

Prepare a response to a missing heartbeat

The alert should identify the job, its last successful result and its owner. A missing backup deserves a different response from a late non-critical report. Before restarting the job, check whether the original process is still running and whether duplicate processing could cause harm.

  • Nightly backups and exports.
  • Product imports and synchronisation.
  • Report generation and billing jobs.
  • Maintenance and scheduled data cleanup.

What to take away

A green website does not prove that background jobs are healthy. Add a separate completion signal wherever a missing result would otherwise be discovered by a customer.

Documentation and further reading

Mgr. Martin Hlavaj, MBA

Software Engineer

All articles

Hear about an outage early.

Add your website or API to UpBot and choose who receives the alert.

Start monitoring for free