feat: create subfolders for checksums to simplify cleanup

This commit is contained in:
2026-05-28 16:30:55 -07:00
parent cd07f48d5b
commit 28ff88c8b8
+2 -2
View File
@@ -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}"