How-to · 31 Oct
How-to · 3 min read
How to get alerted when a cron job quietly stops
You have a nightly backup, an invoice run or a cleanup script on cron, and you want to hear about it the day it stops running, not weeks later. Usually you find out by accident, when a customer asks why a report never arrived, or you open the backup folder and the newest file is from last month. Nothing broke loudly, so nothing told you, and what you want is a way to be told when the expected run did not happen.
01
Why it's hard
Most monitoring watches for things that go wrong, like an error, a crash or a page that returns a bad status. A job that never starts produces none of those, because there is no process to fail and no line to write. Checking logs by hand works until you get busy, and email output from cron only helps if the job runs and the mail server delivers. The missing event is the signal, and ordinary uptime checks are built to look at a URL, not at the absence of one. So the failure you most need to hear about is the one your current setup is least able to see.
This part describes the usual way. It makes no claims about Pulsecima Pulse, so nothing is quoted here.
02
How Pulsecima Pulse does it
Pulsecima Pulse flips the check around. Your job calls a URL when it finishes, and Pulsecima watches for that call instead of waiting for an error. If the ping does not show up, you get an alert through the channels your plan includes. This is called a heartbeat or dead man's switch, and it sits next to the regular URL monitoring in the same account. The point is that silence becomes something you get told about, rather than something you discover on your own when the damage is already done.
A job that stops running raises no error and writes no log line.Quoted from pulse.pulsecima.com
your job pings a URL on success, and we alert you if it doesn't check inQuoted from pulse.pulsecima.com
Heartbeat / cron checks (up to 5)Quoted from pulse.pulsecima.com
03
Step by step
- 1Sign up and move to Basic or Pro, since heartbeat checks are not on the Free plan.
- 2Create a heartbeat check for the job and copy the ping URL it gives you.
- 3Add one line at the end of your script that requests that URL after the work succeeds.
- 4Connect Slack or a webhook on Basic, or PagerDuty on Pro, so the alert reaches the place you actually read.
- 5Use a maintenance window when you pause the job on purpose, so you are not paged for planned downtime.
04
Tips
Put the ping after the real work, not at the top of the script. A ping at the start only proves the job launched, while a ping at the end proves it got through the part you care about. If the script exits early on an error, the ping never fires and the alert does its job.
General advice. Not a claim about the product.
Count your jobs before you pick a plan. Basic covers up to five heartbeat checks, and Pro has no cap, so a team with a dozen scheduled tasks will hit the Basic limit quickly.
Unlimited heartbeat / cron checksQuoted from pulse.pulsecima.com
If your site and your jobs live on the same server, monitor both. A URL check catches the web side going down, and the heartbeat catches the worker that died quietly next to it. Paid plans include both kinds of check, so you are not juggling two tools for one server.
General advice. Not a claim about the product.
Planned pauses are easy to forget. Maintenance windows keep recording history while muting only the alert, which helps when you stop a job during a migration.
only the alert gets suppressed for that window, on every plan.Quoted from pulse.pulsecima.com
05
Questions
Can I monitor cron jobs on the Free plan?
No. Heartbeat checks start on Basic, which includes five, and Pro allows unlimited ones.
It isn't part of the Free plan.Quoted from pulse.pulsecima.com
Where do missed-job alerts go?
Email, plus Slack and webhook on Basic and Pro, and PagerDuty on Pro.
Slack and webhook on Basic and Pro; PagerDuty on Pro.Quoted from pulse.pulsecima.com
Does it check anything other than HTTP?
No. URL checks run over HTTP(S) only, so there are no TCP or ICMP checks.
Pulsecima checks over HTTP(S) only.Quoted from pulse.pulsecima.com