Backup hardening, UPS monitoring, Nextcloud cron, image bumps #10
@@ -42,6 +42,15 @@ $(journalctl -u "$UNIT" -n 40 --no-pager -o cat 2>/dev/null)"
|
||||
|
||||
echo "$body" | logger -t "$TAG" -p "$prio"
|
||||
|
||||
# Only genuine failures are worth an email. A spurious invocation carries no
|
||||
# action for a human, and mailing it trains the reader to ignore the subject
|
||||
# line -- which defeats the point of having the alert at all. The journald
|
||||
# record above is kept either way, so spurious triggers stay greppable.
|
||||
if [ "$state" != "failed" ]; then
|
||||
logger -t "$TAG" -p daemon.info -- "alert_mail=skipped reason=$state"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Mail is best-effort: if the MTA is not configured the journald record above
|
||||
# is still the authoritative signal, so never fail the handler on this.
|
||||
if command -v sendmail >/dev/null 2>&1; then
|
||||
|
||||
Reference in New Issue
Block a user