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
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:
1 parent
8a9a3ca56d
commit
48960e6faf
6 files changed
+65
-1
No files matched your search
+2
-1
@@ -45,7 +45,8 @@ install -d -m 0750 -o kernelwatch -g kernelwatch "$root/var/lib/kernelwatch"
|
||||
|
||||
install -m 0644 "$here/kernelwatch.service" "$root/etc/systemd/system/"
|
||||
install -m 0644 "$here/kernelwatch-alerts.service" "$here/kernelwatch-alerts.timer" \
|
||||
"$here/kernelwatch-backup.service" "$here/kernelwatch-backup.timer" "$root/etc/systemd/system/"
|
||||
"$here/kernelwatch-backup.service" "$here/kernelwatch-backup.timer" \
|
||||
"$here/kernelwatch-backup-failed.service" "$root/etc/systemd/system/"
|
||||
systemctl daemon-reload
|
||||
systemctl enable kernelwatch.service
|
||||
systemctl restart kernelwatch.service
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
[Unit]
|
||||
Description=Notify that the kernelwatch backup failed
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=kernelwatch
|
||||
Group=kernelwatch
|
||||
Environment=KERNELWATCH_CONFIG=/etc/kernelwatch/server.toml
|
||||
ExecStart=/usr/bin/python3 -I /opt/kernelwatch/kernelwatch-server notify-backup-failure
|
||||
TimeoutStartSec=2min
|
||||
StateDirectory=kernelwatch
|
||||
StateDirectoryMode=0750
|
||||
|
||||
CapabilityBoundingSet=
|
||||
AmbientCapabilities=
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelLogs=yes
|
||||
ProtectControlGroups=yes
|
||||
ProtectClock=yes
|
||||
ProtectHostname=yes
|
||||
ProtectProc=invisible
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
RestrictSUIDSGID=yes
|
||||
LockPersonality=yes
|
||||
MemoryDenyWriteExecute=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
UMask=0077
|
||||
@@ -1,5 +1,8 @@
|
||||
[Unit]
|
||||
Description=Back up the kernelwatch database
|
||||
# Any failure, including the timeout, an OOM kill or a crash, sends an ntfy
|
||||
# message (a no-op if ntfy isn't configured).
|
||||
OnFailure=kernelwatch-backup-failed.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
||||
@@ -18,6 +18,7 @@ report_retention_days = 30
|
||||
# and deletes copies this many days old or older (0 keeps them all). Keep the
|
||||
# directory under /var/lib/kernelwatch; the unit can't write elsewhere. Copy the
|
||||
# files off this machine yourself: they don't protect against losing it.
|
||||
# A failed backup run sends an ntfy message (if ntfy_url is set).
|
||||
backup_dir = "/var/lib/kernelwatch/backups"
|
||||
backup_keep_days = 7
|
||||
|
||||
|
||||
Reference in new issue
Block a user