ntfy, Gotify, and Pushover Alerts for Cron Jobs and Backups
Email buries 03:00 backup failures under inbox noise. Full incident suites are heavy for a solo server or small ops team. Mobile push tools like ntfy, Gotify, and Pushover send an audible phone alert from one HTTP call. You can trigger them from a wrapper script on failure, or connect them to Watchgoose so dead hosts and missed runs push to your phone too.
Compare ntfy, Gotify, and Pushover
Pick the service that fits how you host tools and which phone OS you use.
Scroll horizontally to see all columns.
| Feature | ntfy | Gotify | Pushover |
|---|---|---|---|
| Hosting | Self-hosted or hosted ntfy.sh | Self-hosted only | Hosted service (api.pushover.net) |
| Android background delivery | WebSocket, FCM, or UnifiedPush | Persistent WebSocket (disable battery optimization for the app) | FCM |
| iOS delivery | Official app (self-hosted servers need upstream-base-url: "https://ntfy.sh" for APNs wakeups) | No official iOS app or APNs relay | Native APNs, including Critical Alerts during quiet hours |
| Repeat until acknowledged | No server repeat loop | No server repeat loop | Yes: Priority 2 (Emergency) repeats up to 3 hours (50 retries max) |
| Authentication | Optional Bearer tk_... token (unauthenticated ntfy.sh topics are public) | Required app token | App API token + User/Group key (or subscription flow) |
Option 1: Send push alerts from a wrapper script
If you only need an alert when a command exits non-zero, run it through a short /bin/sh wrapper. Keep tokens in chmod 600 files so they stay out of crontab -l and ps aux.
ntfy failure wrapper
Save your topic URL and optional tk_... token in /etc/cron-secrets/ntfy.curl (chmod 600, owned by the job user):
url = "https://ntfy.example.com/ops-backups-9f4a2c"
header = "Authorization: Bearer tk_replace_with_token"
Save /usr/local/bin/ntfy-on-fail (chmod 755):
#!/bin/sh
set -u
if [ "$#" -lt 2 ]; then
printf 'usage: ntfy-on-fail JOB_LABEL COMMAND [ARGS...]\n' >&2
exit 64
fi
label="$1"; shift
out=$(mktemp) || exec "$@"
trap 'rm -f "$out"' EXIT
"$@" >"$out" 2>&1
rc=$?
if [ "$rc" -ne 0 ]; then
tail_msg=$(tail -c 800 "$out")
curl --disable -fsS -m 10 --retry 2 \
-H "Title: FAILED: $label (exit $rc)" \
-H "Priority: high" \
-H "Tags: rotating_light" \
--data-binary "Host: $(uname -n)
Exit status: $rc
$tail_msg" \
--config /etc/cron-secrets/ntfy.curl >/dev/null || :
fi
exit "$rc"
On public https://ntfy.sh without a reserved topic, pick a long random topic name (ops-backups-9f4a2c81b3e7). Anyone who guesses an unreserved topic name can subscribe to it.
Gotify failure wrapper
Gotify accepts tokens via ?token= or the X-Gotify-Key header. Store X-Gotify-Key in /etc/cron-secrets/gotify.curl (chmod 600) so reverse-proxy logs on your Gotify host do not record the token in URLs:
url = "https://gotify.example.com/message"
header = "X-Gotify-Key: A1b2C3d4ReplaceWithAppToken"
To use Gotify in the wrapper script above (which sets $label and $rc), replace the curl call inside if [ "$rc" -ne 0 ] with:
curl --disable -fsS -m 10 --retry 2 \
-F "title=FAILED: $label (exit $rc)" \
-F "message=Host $(uname -n) exited $rc" \
-F "priority=8" \
--config /etc/cron-secrets/gotify.curl >/dev/null || :
Pushover failure call with Emergency repeats
To use Pushover inside the same if [ "$rc" -ne 0 ] wrapper block, post form fields to /1/messages.json. When you set priority=2 (Emergency), Pushover requires retry (at least 30 seconds) and expire (at most 10800 seconds, or 3 hours). Pushover stops after 50 retries even if expire has time left.
# /etc/cron-secrets/pushover.env (chmod 600):
# PUSHOVER_TOKEN=azGDORePK8gMaC0QOYAMyEEuzJnyUi
# PUSHOVER_USER=uQiRzpo4DXghDmr9QzzfQu27cmVRsG
. /etc/cron-secrets/pushover.env
curl --disable -fsS -m 10 --retry 2 \
--form-string "token=$PUSHOVER_TOKEN" \
--form-string "user=$PUSHOVER_USER" \
--form-string "title=FAILED: $label (exit $rc)" \
--form-string "message=Host $(uname -n) failed with exit $rc" \
--form-string "priority=2" \
--form-string "retry=300" \
--form-string "expire=3600" \
https://api.pushover.net/1/messages.json >/dev/null || :
What local push scripts miss
A local wrapper only alerts when the script starts and finishes with a non-zero exit code.
Scroll horizontally to see all columns.
| Failure mode | Local curl wrapper | Watchgoose + push channel |
|---|---|---|
| Script runs and exits non-zero | Sends push alert immediately | Sends Down push alert immediately (with exit code) |
| VM powered off, disk read-only, or cron stopped | No alert (wrapper never runs) | Sends Down push alert after schedule + grace |
| Job hangs on a stalled mount or DB lock | No alert (command never exits) | Sends Down push alert when /start grace or deadline ends |
| Job fails every 5 minutes for 4 hours | Sends 48 alerts unless you track state locally | Pushes once when Down and once when Up |
| Pushover Emergency alert after job recovers | Keeps repeating until you tap Acknowledge | Cancels the Pushover receipt automatically on recovery |
Option 2: Connect ntfy, Gotify, or Pushover to Watchgoose
With Watchgoose, your servers do not hold Pushover, Gotify, or ntfy tokens. Each job pings its check URL when it finishes (or /<exit-status> via the POSIX wrapper). Watchgoose sends the push alert if a check fails or misses its schedule. Missed-run alerts arm after a new check receives its first success ping.
Connect ntfy
- Open Integrations in your Watchgoose project and select ntfy.
- Enter your topic name (up to 64 characters) and server URL (
https://ntfy.shor the root HTTPS URL of your ntfy server, without the topic path). - If the topic requires auth, paste your
tk_...access token. - Pick priorities for down and up events (
5Max down to1Min, or0Disabled to skip recovery alerts) and click Save Integration.
Connect Gotify
- In Gotify, open Apps, create an app named
Watchgoose, and copy its token. - In Watchgoose, open Integrations > Gotify, enter your public HTTPS Gotify URL and the app token.
- Choose priorities for down and up events (
9High,5Normal,2Low, or0Disabled) and save.
Connect Pushover
- In Watchgoose, open Integrations > Pushover.
- Pick priorities for down and up events (
-3Disabled,-2Lowest,-1Low,0Normal,1High, or2Emergency). - Click Subscribe with Pushover and approve the subscription in Pushover.
When down events use Emergency priority (2), Pushover repeats the alert every 5 minutes. Repeats stop when you acknowledge the alert or Pushover's 3-hour limit expires. If the check recovers first, Watchgoose calls Pushover's cancel_by_tag endpoint so the alarm stops on its own.
You can pair mobile push on the same check with Slack, Discord, Microsoft Teams, or PagerDuty and Opsgenie.
Frequently asked questions
Why do self-hosted ntfy alerts arrive late on iPhone?
On iOS, background push wakeups must pass through Apple Push Notification service (APNs). Only the official ntfy.sh server holds APNs keys for the iOS app. Set upstream-base-url: "https://ntfy.sh" in your self-hosted server.yml. Your server sends a tiny poll wakeup via ntfy.sh while keeping the message body on your own host.
How do I get loud failure alerts at night without recovery alerts waking me up?
Set separate priorities for down and up events in Watchgoose. Use High, Max, or Emergency for down events (4 or 5 on ntfy, 9 on Gotify, 1 or 2 on Pushover). Set up events to Low (2 on ntfy and Gotify, -1 on Pushover) or Disabled (0 on ntfy and Gotify, -3 on Pushover).
Does Pushover Emergency priority stop repeating if the cron job recovers?
Yes, when sent through Watchgoose. Watchgoose tags each Emergency message with the check's unique_key. When the check returns to Up, Watchgoose cancels that tag's receipt via Pushover's API so your phone stops repeating the alarm.
Can Watchgoose push to a Gotify or ntfy server on a private LAN or Tailscale IP?
No. Watchgoose blocks outbound requests to private, loopback, and link-local IPs (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8, and 169.254.0.0/16). Tailscale and CGNAT addresses (100.64.0.0/10) also fail because Watchgoose's servers cannot reach a private tailnet over the internet. Expose /message over public HTTPS with an access token, or use hosted ntfy.sh or Pushover.
Why shouldn't I pass my Gotify token as ?token= in a curl script?
Query strings appear in ps process arguments while curl runs and in default Nginx or Caddy access logs (POST /message?token=...). Passing X-Gotify-Key inside a chmod 600 curl --config file keeps the token out of process listings and URL logs.
Sources
- ntfy Documentation: Publishing Messages and Authentication
- ntfy Documentation: Self-Hosted iOS Instant Notifications (
upstream-base-url) - Gotify API Documentation (
/messageandX-Gotify-Key) - Pushover API Documentation: Message Priorities,
retry,expire, and Receipts - Watchgoose Configuring Notifications Documentation