1
0
mirror of https://github.com/garraflavatra/docker-volume-s3-backup.git synced 2025-05-17 05:14:37 +00:00

fix S3_ENDPOINT and BACKUP_KEEP_DAYS compatibility (#19)

This commit is contained in:
Jizu Sun 2022-07-26 07:33:40 +08:00 committed by GitHub
parent 4ac3278ffb
commit d5a7945317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,11 +90,11 @@ if [ -n "$BACKUP_KEEP_DAYS" ]; then
backups_query="Contents[?LastModified<='${date_from_remove} 00:00:00'].{Key: Key}"
echo "Removing old backup from $S3_BUCKET..."
aws s3api list-objects \
aws $aws_args s3api list-objects \
--bucket "${S3_BUCKET}" \
--prefix "${S3_PREFIX}" \
--query "${backups_query}" \
--output text \
| xargs -n1 -t -I 'KEY' aws s3 rm s3://"${S3_BUCKET}"/'KEY'
| xargs -n1 -t -I 'KEY' aws $aws_args s3 rm s3://"${S3_BUCKET}"/'KEY'
echo "Removing complete."
fi