From 2cbddce69ef91c9dfcbeacf22165701a123a975a Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 18 May 2026 22:18:47 +0000 Subject: [PATCH] feat: add oneshot systemd service for scheduled backup check --- deploy/ns8-backup-monitor-check.service | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 deploy/ns8-backup-monitor-check.service diff --git a/deploy/ns8-backup-monitor-check.service b/deploy/ns8-backup-monitor-check.service new file mode 100644 index 0000000..3b403b4 --- /dev/null +++ b/deploy/ns8-backup-monitor-check.service @@ -0,0 +1,25 @@ +# ns8-backup-monitor-check.service +# +# One-shot systemd service that runs the scheduled backup recap check. +# Invoked by ns8-backup-monitor-check.timer — not managed directly. +# +# This service reads backup status from the NS8 cluster Redis, classifies +# the outcome (SUCCESS / PARTIAL / REPO_FAILURE), and sends a recap email +# via ns8-sendmail. It is the scheduled counterpart to the Alertmanager +# webhook path, which only fires on failures. +[Unit] +Description=ns8-backup-monitor scheduled backup status check +After=network.target ns8-backup-monitor.service +# Do not block startup if the main service is not running +Wants=ns8-backup-monitor.service + +[Service] +Type=oneshot +# Run as root to access the NS8 Redis socket and ns8-sendmail +User=root +ExecStart=/usr/bin/python3 -m ns8_backup_monitor.scheduled_check +WorkingDirectory=/opt/ns8-backup-monitor +# Capture stdout and stderr to the journal +StandardOutput=journal +StandardError=journal +SyslogIdentifier=ns8-backup-monitor-check