File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ set -o pipefail -ue
77LOCKFILE=/opt/parmincloud/backups/backup.lock
88exec 100> " $LOCKFILE "
99
10+ AWS=" $( which aws) "
11+
1012remove-lock () {
1113 flock -u 100
1214 flock -xn 100
@@ -46,16 +48,16 @@ if [ -n "$S3_PREFIX" ]; then
4648 S3_UPLOAD_URI=" s3://${S3_BUCKET} /${S3_PREFIX} /$REMOTE_FILENAME "
4749fi
4850
49- aws s3 cp " $LOCAL_FILENAME " " $S3_UPLOAD_URI "
51+ $AWS s3 cp " $LOCAL_FILENAME " " $S3_UPLOAD_URI "
5052
5153if [ -n " $BACKUP_RETENTION_DAYS " ]; then
5254 log " Removing old backups from S3..."
5355 S3_RETENTION_QUERY=" Contents[?LastModified<='$( subtract-date-from-now $BACKUP_RETENTION_DAYS ) 00:00:00'].{Key: Key}"
54- aws s3api list-objects \
56+ $AWS s3api list-objects \
5557 --bucket " ${S3_BUCKET} " \
5658 --prefix " ${S3_PREFIX:- } " \
5759 --query " ${S3_RETENTION_QUERY} " \
58- --output text | xargs -P " $( nproc) " -I ' {}' aws s3 rm " s3://${S3_BUCKET} /{}"
60+ --output text | xargs -P " $( nproc) " -I ' {}' $AWS s3 rm " s3://${S3_BUCKET} /{}"
5961fi
6062
6163log " Backup successfully done"
You can’t perform that action at this time.
0 commit comments