Backups with Cronwatch
This check is set for a nightly backup with one hour of grace. The bash snippet reports start, success and failure, so you also see how long each backup takes.
- Create the check: daily with one hour of grace. Raise it if your backup runs longer than that.
- Put your backup command, for example pg_dump or restic, where the snippet says /path/to/job.sh.
- Confirm an alert email so a missed backup reaches you, not just a log file.
- Run the backup once and check the run time Cronwatch records.
What to know
Backups fail quietly more often than they fail loudly: a full disk, an expired credential, a renamed database or a changed path make the script exit early, and nobody looks until a restore is needed. Monitoring the backup job turns that silent failure into an email on the same day.
Report failure explicitly. pg_dump and most backup tools exit with a non-zero status on error, so the bash snippet calls /fail and you are alerted immediately. A run that hangs or never starts is caught by the schedule and grace period instead.
Watch the run time as well. A nightly backup that suddenly takes a fraction of its usual time often means it backed up the wrong thing or an empty database. The /start and success pings record each duration so the change is visible.
Updated · Cosmovex
Questions
Does Cronwatch store my backups?
No. It only receives a ping with the time, the type of ping and the user agent. Your data never touches it.
How do I alert on a failed pg_dump?
Run pg_dump inside the bash snippet. When it exits with an error, the snippet requests /fail and you get an alert straight away.
Can I check that the backup is not empty?
Add your own test before the success ping, for example comparing the file size, and call /fail when the test fails.
Is this free?
Yes, for up to 3 checks with email alerts. Pro covers 50 checks and Slack, Discord and webhook alerts.
The free plan covers everything on this page. Cronwatch Pro ($5/mo, billed monthly) is described on the Cronwatch page.