Files
setup-email-pve-pbs/setup-email-pve.sh

48 lines
1.2 KiB
Bash

#!/bin/bash
set -e
read -rp "SMTP author (z.B. MH-PVE02 | MAIERHOME H33): " AUTHOR
read -rp "SMTP from-address (z.B. MH-PVE02@vmd55888.de): " FROMADDR
read -rp "SMTP server (z.B. mail.vmd55888.de): " SERVER
read -rp "SMTP port (z.B. 587): " PORT
read -rp "SMTP mode (starttls/ssl/none): " MODE
read -rp "SMTP username: " USERNAME
read -rsp "SMTP password: " PASSWORD
echo
read -rp "Mailto Adresse (Empfänger): " MAILTO
SENDER="mailout"
TARGET="mail-to-root"
MATCHER="default-matcher"
POLICY="default"
echo "Setze SMTP Sender..."
pvesh set /config/notifications/senders/$SENDER \
--type smtp \
--author "$AUTHOR" \
--from-address "$FROMADDR" \
--server "$SERVER" \
--port "$PORT" \
--mode "$MODE" \
--username "$USERNAME" \
--password "$PASSWORD"
echo "Setze Ziel..."
pvesh set /config/notifications/targets/$TARGET \
--type sendmail \
--mailto "$MAILTO" \
--mailto-user root@pam
echo "Setze Matcher..."
pvesh set /config/notifications/matchers/$MATCHER \
--comment "Route all notifications to $TARGET" \
--mode all \
--target "$TARGET"
echo "Setze Policy..."
pvesh set /config/notifications/policies/$POLICY \
--sender "$SENDER" \
--targets "$TARGET"
echo "Fertig! Prüfe die Einstellungen in der WebUI."