AlertKite
← AlertKite

Monitor a cPanel cron job and get WhatsApp alerts when it stops

cPanel's cron emails are output-driven: you hear from a job that prints something, and never from one that stopped running. That is backwards. A job producing errors is annoying; a job that silently stopped is the one that loses data.

Most people then set the cron email to a blank address to stop the noise, which removes the last signal they had.

cPanel → Cron Jobs → Add New Cron Job

/usr/local/bin/php /home/USER/public_html/backup.php >/dev/null 2>&1 && curl -fsS -m 10 https://hb.alertkite.com/p/YOUR_TOKEN >/dev/null

Setting it up

  1. Create a heartbeat monitor and copy its ping URL.
  2. Open cPanel → Cron Jobs and edit the command.
  3. Append && curl … so the ping only fires when the job exits successfully.
  4. Set the monitor's period to match the schedule you chose in cPanel.

Use the full path to PHP

Cron on shared hosting runs with a minimal PATH, and the php on it is often an older version than the one your site uses. cPanel shows the correct absolute path under 'Cron Jobs' — using it avoids a job that works when you test it by hand and fails on schedule.

Keep >/dev/null 2>&1 before the &&

It suppresses the output that generates cPanel's emails, without suppressing the exit code that decides whether the ping fires. You get silence when things work and a WhatsApp message when they do not, which is the right way round.

Shared hosting kills long jobs

Many hosts cap cron execution time, so a backup that grows past the limit starts being killed mid-run. Ping /start at the beginning and the plain URL at the end, and the recorded duration will show the job creeping towards the ceiling before it hits it.