setup-email-pbs.sh hinzugefügt

This commit is contained in:
2025-05-20 21:48:29 +02:00
parent 156c957151
commit 4bc66c4141

41
setup-email-pbs.sh Normal file
View File

@@ -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 <<EOF > "$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."