new scripts

This commit is contained in:
Andreas Knuth 2025-12-17 12:38:10 -06:00
parent 93f2c0c3bd
commit e60faffbde
3 changed files with 25 additions and 0 deletions

0
basic_setup/create-queue.sh Normal file → Executable file
View File

0
basic_setup/manage_mail_user.sh Normal file → Executable file
View File

25
basic_setup/set-rule.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
EMAIL=$1
OOO_ACTIVE=$2 # true/false
OOO_MESSAGE="$3"
OOO_CONTENT_TYPE=${4:-text} # Optional: text oder html, default text
FORWARDS="$5" # Komma-separiert, z.B. "ebrunks@bayarea-cc.com,andreas.knuth@bayarea-cc.com"
if [ -z "$EMAIL" ] || [ -z "$OOO_ACTIVE" ]; then
echo "Usage: $0 email@domain.com true/false 'OOO Message' [ooo_content_type] 'forward1,forward2'"
exit 1
fi
FORWARDS_LIST=$(echo "$FORWARDS" | jq -R 'split(",") | map({"S": .})') # Konvertiere zu JSON-Array von {"S": "value"}
aws dynamodb put-item \
--table-name email-rules \
--item '{
"email_address": {"S": "'"$EMAIL"'"},
"ooo_active": {"BOOL": '"$OOO_ACTIVE"'},
"ooo_message": {"S": "'"$OOO_MESSAGE"'"},
"ooo_content_type": {"S": "'"$OOO_CONTENT_TYPE"'"},
"forwards": {"L": '"$FORWARDS_LIST"'},
"last_updated": {"S": "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}
}' \
--region us-east-2