26 lines
1.3 KiB
Bash
Executable File
26 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Post-Update-Hook: PVE-Notification-Target mail-to-root deaktivieren
|
||
#
|
||
# Ablage: /etc/miyagi-backup/hooks.d/post-update/
|
||
# Ausführung: chmod +x <hookname>.sh
|
||
# Reihenfolge: alphabetisch (01-foo.sh, 02-bar.sh, ...)
|
||
# Fehlerverhalten: Exit != 0 erzeugt WARNUNG im Log, weitere Hooks laufen weiter
|
||
#
|
||
# Migriert aus disable_pve_notifications() (v3/miyagi-backup.sh) — vormals
|
||
# unconditional in run_remote_updates() aufgerufen, jetzt hier als Hook,
|
||
# also nur aktiv wenn Datei ausführbar hier liegt.
|
||
set -uo pipefail
|
||
|
||
command -v pveversion >/dev/null 2>&1 || exit 0
|
||
|
||
if [[ "$(hostname -I 2>/dev/null)" == *"${SOURCEHOST:-}"* || "$(hostname)" == "${SOURCEHOST:-}" ]]; then
|
||
echo "Lokaler Host ist SOURCEHOST – Notification-Deaktivierung wird hier übersprungen."
|
||
exit 0
|
||
fi
|
||
|
||
echo "PVE erkannt – deaktiviere Notification-Target mail-to-root und default-matcher (keine lokalen Mails an root)."
|
||
pvesh set /cluster/notifications/endpoints/sendmail/mail-to-root --disable 1 >/dev/null 2>&1 \
|
||
|| echo "WARN: Notification-Target mail-to-root konnte nicht deaktiviert werden."
|
||
pvesh set /cluster/notifications/matchers/default-matcher --disable 1 >/dev/null 2>&1 \
|
||
|| echo "WARN: Notification-Matcher default-matcher konnte nicht deaktiviert werden."
|