moving
This commit is contained in:
32
basic_setup/legacy/s3-retention.sh
Executable file
32
basic_setup/legacy/s3-retention.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Aktualisiere Lifecycle-Regeln (7 Tage) für alle E-Mail-Buckets..."
|
||||
|
||||
for BUCKET in $(aws s3api list-buckets --query 'Buckets[].Name' --output text); do
|
||||
|
||||
# Prüfen, ob der Name auf '-emails' endet
|
||||
if [[ "$BUCKET" == *-emails ]]; then
|
||||
echo "⚙️ Setze 7-Tage-Regel für: $BUCKET"
|
||||
|
||||
aws s3api put-bucket-lifecycle-configuration \
|
||||
--bucket "$BUCKET" \
|
||||
--lifecycle-configuration '{
|
||||
"Rules": [
|
||||
{
|
||||
"ID": "DeleteOldEmails",
|
||||
"Status": "Enabled",
|
||||
"Expiration": {
|
||||
"Days": 7
|
||||
},
|
||||
"Filter": {
|
||||
"Prefix": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
else
|
||||
echo "⏭️ Überspringe (kein E-Mail-Bucket): $BUCKET"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Fertig! Alle E-Mail-Buckets löschen jetzt Objekte nach 7 Tagen."
|
||||
Reference in New Issue
Block a user