From 28ff88c8b862091071a40cb7cbf52e1a18920961 Mon Sep 17 00:00:00 2001 From: Vasili Sviridov Date: Thu, 28 May 2026 16:30:55 -0700 Subject: [PATCH] feat: create subfolders for checksums to simplify cleanup --- backup-bitwarden.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup-bitwarden.sh b/backup-bitwarden.sh index fdbce1d..0cbb5a2 100755 --- a/backup-bitwarden.sh +++ b/backup-bitwarden.sh @@ -11,7 +11,7 @@ tmpdir="$(mktemp -d -p "${PWD}")" function check_for_hash() { local ret=0 echo -n "Checking if hash ${1} is present: " - aws s3 ls "s3://${S3_BUCKET}/sums/${1}" || ret=$? + aws s3 ls "s3://${S3_BUCKET}/sums/$(date +%Y/%m)/${1}" || ret=$? case "$ret" in 0) echo "Yes." ;; *) echo "No." ;; @@ -25,7 +25,7 @@ function create_and_upload() { backup_file="$(date +%Y/%m/${DATABASE_URL}_backup-%d-%H-%M-%S.tar.gz)" echo "Uploading ${backup_file}" tar -zc . | aws s3 cp - "s3://${S3_BUCKET}/${backup_file}" - aws s3api put-object --bucket "${S3_BUCKET}" --key "sums/${sum}" + aws s3api put-object --bucket "${S3_BUCKET}" --key "sums/$(date +%Y/%m)/${sum}" } chmod ugo+wX "${tmpdir}"