feat: create subfolders for checksums to simplify cleanup
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ tmpdir="$(mktemp -d -p "${PWD}")"
|
|||||||
function check_for_hash() {
|
function check_for_hash() {
|
||||||
local ret=0
|
local ret=0
|
||||||
echo -n "Checking if hash ${1} is present: "
|
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
|
case "$ret" in
|
||||||
0) echo "Yes." ;;
|
0) echo "Yes." ;;
|
||||||
*) echo "No." ;;
|
*) echo "No." ;;
|
||||||
@@ -25,7 +25,7 @@ function create_and_upload() {
|
|||||||
backup_file="$(date +%Y/%m/${DATABASE_URL}_backup-%d-%H-%M-%S.tar.gz)"
|
backup_file="$(date +%Y/%m/${DATABASE_URL}_backup-%d-%H-%M-%S.tar.gz)"
|
||||||
echo "Uploading ${backup_file}"
|
echo "Uploading ${backup_file}"
|
||||||
tar -zc . | aws s3 cp - "s3://${S3_BUCKET}/${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}"
|
chmod ugo+wX "${tmpdir}"
|
||||||
|
|||||||
Reference in New Issue
Block a user