Linux crontab
Run the command, capture the exit code, then curl the ping URL. Pass the code so a failed backup is a fail ping, not a success.
# crontab -e
0 3 * * * /usr/local/bin/backup.sh
code=$?
curl -fsS -m 10 --retry 3 "$CRONNUDGE_URL?exit=$code"
exit $code- Put CRONNUDGE_URL in the crontab environment or inline the full https://cronnudge.com/ping/… URL.
- A non-zero exit is stored as a failure. Zero is a success.
- If the machine is off, nothing pings, and the check is late when the window closes. That is the signal you want.
Longer guide: Crontab not running · Daylight saving time · Render, Railway, and Fly.io · whenever and Rails jobs · Cron in Docker · Cron logs · Slack and Discord alerts · Environment variables · Stuck or hanging jobs