J
Size: a a a
J
S
#!/bin/bash
if [[ $1 == "" ]]
then
echo "Error! Empty input variable"
exit 1
fi
for month in $(cat list.txt)
do
echo "{
\"Rules\": [
{
\"ID\": \"$1-$month-cleanup\",
\"Prefix\": \"prod/$1/2020/$month/\",
\"Status\": \"Enabled\",
\"Expiration\": {
\"Days\": 31
},
\"AbortIncompleteMultipartUpload\": {
\"DaysAfterInitiation\": 1
}
}
]
}
" > $1-$month.json
aws s3api put-bucket-lifecycle --profile mtu --bucket test2 --lifecycle-configuration file://$1-$month.json
done
AT
AT
AT
AT
AT
AT