Exit codes and failure signals
On this page
Every command ends with an exit status from 0 to 255. Zero means success and anything else means failure. Send it to CronMissed as the last part of the ping URL and a failed job alerts within seconds, instead of waiting for the missing success ping to time out.
How do I send the exit status?
/usr/local/bin/backup.sh; curl -fsS --retry 5 https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10/$?The semicolon (and not &&) runs the ping whatever the job did, and $? holds the job's status. A status of 0 is a success ping; any other number marks the check down at once and records the number. /fail does the same without a number. Both accept a POST body with the error output.
Which codes mean what?
| Code | Usual meaning |
|---|---|
| 0 | Success |
| 1 | General error; also the usual code for "found nothing" in some tools |
| 2 | Misuse of a shell built-in or a usage error |
| 126 | The command was found but could not be run, often a missing execute bit |
| 127 | Command not found, the classic sign of a PATH problem under cron |
| 128 + N | The process was killed by signal N; 137 means kill -9 and 143 means SIGTERM |
Tools define their own codes too. restic, BorgBackup and rsync each document codes for partial success, and a wrapper can map the ones you accept to 0.
Which traps hide a failure?
- A pipeline reports the status of its last command. Use
set -o pipefailin bash, or checkPIPESTATUS. - A script that ends with a harmless command, such as echo, exits 0 whatever happened before it. Add
set -e, or exit with the real status. - A shell function that swallows errors with
|| trueis a success by design. - A PowerShell script sets no exit code unless you do; use
exit $LASTEXITCODE.
Sources
- BorgBackup documentation: return codes , read 22 October 2026
Questions and answers
- Exit statuses are one byte, so they wrap around: 256 becomes 0. Keep your own codes between 1 and 125.
- Yes. POST the last 100 kB of output to the same URL; it is kept with the ping and included in the alert for failures.
What happens to a status above 255?
Can I send a message with the failure?
Create a check, add one curl to the job, and CronMissed alerts you when a ping is late or reports a failure.
Start monitoring