Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How to monitor cron jobs (and know when they silently fail)

Cron has one job: start a command at a time. It doesn’t check whether the command worked, and it can’t tell you about runs that never started. Nobody looks for those, so they cost the most. The backup that stopped in March gets noticed in June, when someone needs a restore. The ways a cron job fails There are two kinds of failure, and you catch them in different ways. The job runs and fails. The…

Cron jobs are designed to start a command at a specified time, but they do not verify if the command succeeded or fail if it didn't run due to various reasons. Often, these silent failures go unnoticed until they become critical, such as when a backup stops working. There are two primary types of failure: the job runs and fails, or the job doesn't run at all.

To monitor cron jobs and detect these silent failures, a heartbeat check, also known as a dead man's switch, should be implemented. This involves creating a check that the job calls when it completes successfully within a specified grace period. If the check does not receive a response within the grace period, an alert is triggered.

To set up a heartbeat check effectively, it's crucial to avoid common pitfalls. For instance, pinging the check after the job's command, even if it fails, or placing the ping URL in the crontab, which anyone can access, are significant mistakes. Instead, the ping URL should be kept secure, accessible only to the job's user or stored in a secret management system.

It's also essential to use the same schedule and time zone for the check and the job, as cron schedules are time-zone sensitive. If the job's run time varies significantly, the grace period should be adjusted accordingly to account for the longest expected duration. Additionally, if a job can run multiple times at once, implementing a lock mechanism like 'flock' can prevent conflicts between runs.

The heartbeat check can also be used to detect if a job is performing incorrectly, such as when it exits with a non-zero status code or writes the wrong output. This can be accomplished by including additional data, like the size of the backup or the number of rows processed, in the ping request and setting specific thresholds for alerts.

This approach ensures that not only does the job run on time, but it also performs its intended function correctly. The heartbeat check can be implemented across various scheduling systems, including crontab, systemd timers, Kubernetes CronJobs, and GitHub Actions, by following the provided recipes for each system.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Why Lump-Sum Authorize.net, NMI & Stripe Invoice Portals Fail Visa CEDP in 2026 (And How to Fix Payloads Without Touching PANs)

If you maintain a B2B /pay-invoice page or an ERP payment connector on Authorize.net, NMI, or Stripe Interchange-Plus, April 17, 2026 quietly changed the rules on commercial card processing.

  • Visa's CEDP implemented April 17, 2026, replacing legacy US Level 2 interchange
  • Lump-sum invoice portals on Authorize.net, NMI, Stripe fail to meet CEDP standards
  • Open-source pre-flight checker validates payloads before capture to meet CEDP requirements

Your nightly OPTIMIZE and your streaming MERGE are fighting over the same files

The maintenance notebook is three lines, it ran fine for a month, and now it fails most nights with a concurrent modification error. Nothing changed in the notebook.

  • Maintenance job fails nightly due to concurrent modification errors
  • Streaming job feeding same table becomes busier, causing conflicts
  • Optimize specific partition with partition predicate to resolve issue

How to Become a Forward Deployed Engineer: Career Guide for Developers, Architects and Business Analysts

Short answer Developers, architects and business analysts each bring part of the forward deployed engineer profile. Developers have the code, architects the systems thinking, analysts the discovery…

  • Forward deployed engineers combine developer, architect, and business analyst skills.
  • Success requires expertise in all three areas and comfort with ambiguity and pressure.
  • Transition involves six to twelve months of skill-building and customer engagement.

Debezium on Oracle: One Idle Transaction, One Log Purge, and a Connector That Can't Resume

The CDC pipeline from Oracle to Kafka has run for weeks with near-zero lag. One night the Debezium task fails: LogFileNotFoundException: None of the log files contain offset SCN: 2303670 after 6…

  • Oracle-Debezium connector failed due to idle transaction, causing LogFileNotFoundException
  • Connector unable to resume as SCN of open transaction no longer available on server
  • Reconfigure connector to snapshot mode, perform snapshot to restart and prevent future failures

More from Tuesday, 1 December 2026 →