diff --git a/setup-email-pbs.sh b/setup-email-pbs.sh new file mode 100644 index 0000000..61d3c19 --- /dev/null +++ b/setup-email-pbs.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +echo "=== [PBS] E-Mail-Benachrichtigungen einrichten ===" + +read -p "SMTP Server (z.B. smtp.example.com): " SMTP_SERVER +read -p "SMTP Port [587]: " SMTP_PORT +SMTP_PORT=${SMTP_PORT:-587} + +read -p "SMTP Benutzer (z.B. user@example.com): " SMTP_USER +read -s -p "SMTP Passwort: " SMTP_PASS +echo + +read -p "Absender-Name (z.B. PBS Server): " SENDER_NAME +read -p "Absender-Adresse (z.B. pbs@example.com): " MAIL_FROM +read -p "Empfänger-Adresse (z.B. admin@example.com): " MAIL_TO + +CONFIG_FILE="/etc/proxmox-backup/email-notification.cfg" + +echo +echo "==> Konfiguration wird geschrieben..." + +cat < "$CONFIG_FILE" +{ + "mail-to": "$MAIL_TO", + "mail-from": "$MAIL_FROM", + "smtp-server": "$SMTP_SERVER", + "smtp-port": $SMTP_PORT, + "smtp-user": "$SMTP_USER", + "smtp-pass": "$SMTP_PASS", + "smtp-starttls": true +} +EOF + +chmod 600 "$CONFIG_FILE" +chown root:root "$CONFIG_FILE" + +echo +echo "==> Testmail wird gesendet..." +proxmox-backup-manager notify send --to "$MAIL_TO" --subject "Testmail von $SENDER_NAME" --body "Das ist eine Testbenachrichtigung von $SENDER_NAME <$MAIL_FROM>" + +echo "==> Fertig mit PBS-Konfiguration."