#!/bin/bash # felhom-backup-failmail — mail admin@ that a Felhom backup unit on DooPlex failed (R-232 (a) route, reused). # Called by felhom-backup-failmail@.service, which the backup units name in OnFailure=. # Reuses notify_failure from /opt/backup/scripts/backup-config.sh (Resend; never prints the key; never fails). # No `set -u`: backup-config.sh reads unset variables (NOTIFY_WEBHOOK_URL), which killed the first dry run. UNIT=${1:?unit name} CONFIG=${FELHOM_FAILMAIL_CONFIG:-/opt/backup/scripts/backup-config.sh} # shellcheck source=/dev/null . "$CONFIG" notify_failure "systemd unit ${UNIT} failed on $(hostname) — see: journalctl -u ${UNIT}"