Task notifications cron · CLI
Catch backup and scheduled-job failures
Send the failure of an unattended job to your phone, with enough context to investigate.
Prepare server notificationsUpdated
When to use it
A backup runs while you sleep. If the command starts and returns an error, the script can notify you and retain the failure status for its scheduler. Keep the message short, name the job, and point yourself to its existing log.
Connect in three steps
Use the scheduler’s account
Install and pair the CLI as the user that runs the scheduled job. Check the absolute CLI path.
Notify on the failure path
Save the job exit status, send a failure summary and return the original status to the scheduler.
Test in the scheduled environment
Run a harmless failure with the scheduler’s PATH and configuration. Then attach the pattern to the existing backup script.
Start here
First, get Ntfyx on your phone
On a computer? Click a store to scan its QR code with your phone.
Check that it works
This POSIX shell rehearsal uses false, so it does not touch backup files. Run it with sh and confirm the phone gets a failure message and the script exits 1. Replace false with true to check that a successful run remains quiet. In cron, use verified absolute paths or set PATH explicitly.
# Harmless failure rehearsal; no backup files are touched.
task_status=0
false || task_status=$?
if [ "$task_status" -ne 0 ]; then
ntfyx send "Backup test failed (exit $task_status)" || \
printf '%s\n' 'Notification failed; inspect the job log.' >&2
fi
exit "$task_status"What to know
This detects errors returned by a job that actually ran. A powered-off host or a job that never starts cannot execute its notification; detecting missed runs needs a separate heartbeat mechanism. Notification delivery also depends on connectivity and limits. Keep your scheduler’s logs so a notification failure remains visible.