From d5a79453172f2acb76501a1214429448ccb21adb Mon Sep 17 00:00:00 2001 From: Jizu Sun Date: Tue, 26 Jul 2022 07:33:40 +0800 Subject: [PATCH] fix S3_ENDPOINT and BACKUP_KEEP_DAYS compatibility (#19) --- src/backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backup.sh b/src/backup.sh index 2d84359..48a99c0 100644 --- a/src/backup.sh +++ b/src/backup.sh @@ -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