From 4bc66c4141287e3982d8b972d8f80c6718cbde7a Mon Sep 17 00:00:00 2001 From: "manuel.maier" Date: Tue, 20 May 2025 21:48:29 +0200 Subject: [PATCH] =?UTF-8?q?setup-email-pbs.sh=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup-email-pbs.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 setup-email-pbs.sh 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."