--- title: "Healthchecks.io: Know When a Cron Job Silently Stops Running" author: "Anshu Pathak" published: "2026-11-24T03:13:20.814Z" updated: "2026-11-24T03:13:20.814Z" url: "https://zyvop.com/healthchecks-io-know-when-a-cron-job-silently-stops-running-13u9v" canonical: "https://zyvop.com/healthchecks-io-know-when-a-cron-job-silently-stops-running-13u9v" tags: ["monitoring","healthchecks","automation","cron","DevOps"] --- # Healthchecks.io: Know When a Cron Job Silently Stops Running Get alerts when cron jobs miss a run, fail, or hang with Healthchecks.io's simple ping-based monitoring. ![Cover image]() A cron job that fails with an error is easy to notice. The dangerous failures are silent: the server rebooted, cron lost its configuration, a script hung, or the job never ran. Healthchecks.io works as a dead man's switch: your job pings a URL when it finishes, and you get an alert when an expected ping does not arrive. ```mermaid flowchart LR J[Cron job] -->|ping when done| H([Healthchecks]) H -->|ping arrives on time| U[Check stays Up] H -->|no ping by due time plus grace| D[Check goes Down] D --> N[Email, Slack, SMS, webhook] ``` ## What it catches A ping sent at the end of a successful run detects: - the whole machine being down - the cron daemon not running or having an invalid configuration - a job that exits with a non-zero code - a job that runs for an abnormally long time Cron's built-in `MAILTO` is a poor substitute. It needs a configured mail server, says nothing when the whole machine is off or offline, and emails you on every run of a job that prints anything. Healthchecks.io is not an uptime checker: it does not probe websites, collect metrics or aggregate logs. ## Create a check and add a ping Create a check in the web UI, tell it how often the job should run (a simple period, a cron expression, or an OnCalendar expression for systemd timers), set a grace time, and copy the ping URL. Then add the ping to the job: ```cron 8 6 * * * /home/me/backup.sh && curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/your-uuid ``` `&&` sends the ping only when the script exits with 0. The curl flags fail on HTTP errors (`-f`), print nothing but errors (`-sS`), give up after 10 seconds (`-m 10`), retry transient errors up to 5 times (`--retry 5`) and discard the response (`-o /dev/null`). The quiet output matters: when cron mail is set up, any output a job prints is emailed on every run. ## How a check goes down A check is New until its first ping, then Up. When the next ping is due and has not arrived, it becomes Late, and it goes Down once the grace time has also passed. Alerts go out when it goes Down. With a cron schedule of `8 6 * * *` and a 30-minute grace time, the check becomes Late at 06:08, and you are alerted at 06:38 if no ping has arrived. Set the grace time above the job's normal runtime. If you use a cron expression, set the check's time zone to match the machine's. A ping that is consistently an hour early or late usually means a mismatch, and `timedatectl status` shows the system time zone. ## Catch failures and hangs A single ping at the end cannot tell a job that never started from one that started and hung, and it says nothing about why a job failed. Add a start signal, and report the exit status instead of a plain success: ```bash #!/usr/bin/env bash HC="https://hc-ping.com/your-uuid" curl -fsS -m 10 --retry 5 -o /dev/null "$HC/start" output=$(/home/me/backup.sh 2>&1) status=$? printf '%s' "$output" | tail -c 10000 | curl -fsS -m 10 --retry 5 -o /dev/null --data-binary @- "$HC/$status" exit "$status" ``` - `/start` starts a timer. Healthchecks shows the run time, and a job that sends a start signal but no success within the grace time is treated as failed. - `/` counts 0 as success and any other number as failure. Signaling a failure actively shortens the time between the job failing and your alert. - If the request body looks like UTF-8 text, Healthchecks.io stores its first 100 kB. The script sends only the last 10 kB of output, because the error is usually at the end. If runs of the same job can overlap, add `?rid=`, with a UUID you generate for each run, to both the start ping and the finishing ping. Healthchecks.io then matches each duration to the right start. Instead of one UUID per check, you can ping `https://hc-ping.com//`, which keeps scripts readable. Adding `?create=1` creates the check on its first ping. Auto-provisioning is off by default, and an ambiguous slug returns a 409 and is ignored. ## Alerts and reminders Healthchecks supports many integrations, including email, Slack, PagerDuty, SMS and webhooks. Set up more than one channel, so a message that lands in spam does not hide a failure. Route low-priority jobs to email only and critical ones to email, SMS and team chat. Under Account Settings, Email Reports, you can also get a repeated reminder every hour or day while any check is down. Anything that can make an HTTP request can ping: systemd timers, Windows Scheduled Tasks, Jenkins jobs, wp-cron and Heroku Scheduler. Some tools ping on their own, such as Litestream's `heartbeat-url` setting. ## Self-host it Healthchecks is open source (BSD 3-clause) and also available as a hosted service. The self-hosted version is a Django app that needs Python 3.12+ and PostgreSQL or MySQL (the development setup stores data in a SQLite file). It must also be able to send email, so it can deliver login links and alerts. The quickest route is the sample Docker Compose setup from the source repository: ```bash git clone https://github.com/healthchecks/healthchecks.git cd healthchecks/docker cp .env.example .env # then edit .env docker compose up docker compose run web /opt/healthchecks/manage.py createsuperuser ``` At a minimum, set `ALLOWED_HOSTS`, `DEFAULT_FROM_EMAIL`, `EMAIL_HOST`, `EMAIL_HOST_USER`, `EMAIL_HOST_PASSWORD`, `SECRET_KEY` and `SITE_ROOT` in `.env`. The image runs `sendalerts` and `sendreports` in the background for you, but it does not handle TLS. Put a reverse proxy in front that sets the `X-Forwarded-For` and `X-Forwarded-Proto` headers, or you can run into CSRF 403 errors. If you run it from source instead, `sendalerts` is a separate process that you start with `./manage.py sendalerts`, and **when it is not running, the instance sends no alerts at all**. Make sure it survives server restarts, for example by running it under systemd or supervisor. The `sendreports` command sends the reports and reminders. ## Gotchas - **A pipeline can hide a failure.** In Bash, a pipeline returns the exit status of its last command, so `pg_dump | gpg ...` reports success even if `pg_dump` fails. Add `set -o pipefail` to the script. - **Treat check UUIDs and project ping keys as secrets.** Anyone who has one can send signals to your checks and mess with your monitoring. - **A self-hosted instance cannot alert you about its own outage.** Have a cron job on the server ping a check on a different instance, such as the hosted service. - **The free log is short.** At the time of writing, the free hosted plan monitors 20 checks and keeps 100 log entries per check, which covers about 8 hours of a job that runs every 5 minutes. - **Send the final ping after the work is done,** not at the start of the script. - **Do not ping a check more than 5 times a minute.** Extra pings may be rate limited and not recorded. ## Where to start Add a check to your most important nightly job, usually the backup, and confirm that you get an alert by skipping one run on purpose.