Notify via ntfy when the nightly backup fails
CI / tests (Python 3.10) (pull_request) Successful in 25s
CI / tests (Python 3.11) (pull_request) Successful in 24s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 25s
CI / lint (pull_request) Successful in 3s

kernelwatch-backup.service gets OnFailure=kernelwatch-backup-failed.service,
which runs notify-backup-failure, so timeouts, OOM kills and crashes are
reported as well as handled errors. The installer ships the new unit, and tests
check that every OnFailure= target is a real unit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Sonnet 5.5 committed 2026-10-30 11:13:33 -04:00
1 parent 8a9a3ca56d
commit 48960e6faf
6 files changed
+65 -1

No files matched your search

+12
View File
@@ -465,6 +465,7 @@ sudo kernelwatch remove-user USER
sudo kernelwatch list-users
sudo kernelwatch backup PATH write a consistent copy of the database (safe while running)
sudo kernelwatch scheduled-backup dated copy in backup_dir, then prune old ones (what the timer runs)
sudo kernelwatch notify-backup-failure send the failed-backup notification now (also runs on failure)
sudo kernelwatch check-alerts check for stale, recovered, reboot and update alerts now
sudo kernelwatch test-alert send a test notification to the configured ntfy topic
```
@@ -505,6 +506,17 @@ journalctl -u kernelwatch-backup # a failed run shows up here
sudo systemctl start kernelwatch-backup # back up now
```
If a run fails, whether from an error, the 10-minute timeout, an out-of-memory
kill or a crash, systemd starts `kernelwatch-backup-failed.service`
(`OnFailure=`), which sends a high-priority message to your ntfy topic naming the
newest backup still on disk. The cause is in `journalctl -u kernelwatch-backup`.
Without `ntfy_url` it only logs that it had nothing to send to. If ntfy itself is
unreachable at that moment, the failure shows up only in the journal
(`journalctl -u kernelwatch-backup-failed`). It can't tell you that the timer
never ran at all, for example because the host was down; that needs a heartbeat
monitor. You can check delivery with
`sudo kernelwatch notify-backup-failure`, which sends the same message.
These copies sit on the dashboard host, so they protect against a corrupted or
mistakenly changed database but not against losing the machine. Copy
`/var/lib/kernelwatch/backups/` elsewhere with whatever you already back up with.