Add notify-backup-failure command
Sends a high-priority ntfy message that the nightly backup failed, naming the newest backup still on disk. It exits 1 if the message can't be delivered and 0 (with a note on stderr) when ntfy isn't configured. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6652a4d795
commit
8a9a3ca56d
4 files changed
+90
No files matched your search
@@ -43,6 +43,10 @@ def cmd_test_alert(cfg, args) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_notify_backup_failure(cfg, args) -> int:
|
||||
return alerts.notify_backup_failure(cfg)
|
||||
|
||||
|
||||
def cmd_backup(cfg, args) -> int:
|
||||
db.init(cfg.db_path)
|
||||
try:
|
||||
@@ -179,6 +183,9 @@ def main(argv: list[str] | None = None) -> int:
|
||||
p = sub.add_parser("backup", help="write a consistent copy of the database to PATH")
|
||||
p.add_argument("path")
|
||||
p.set_defaults(func=cmd_backup)
|
||||
sub.add_parser("notify-backup-failure", help="send the failed-backup notification "
|
||||
"(run by systemd when kernelwatch-backup.service fails)").set_defaults(
|
||||
func=cmd_notify_backup_failure)
|
||||
sub.add_parser("scheduled-backup", help="back up to backup_dir and prune old backups "
|
||||
"(run by kernelwatch-backup.timer)").set_defaults(func=cmd_scheduled_backup)
|
||||
|
||||
|
||||
Reference in new issue
Block a user