Skip to content

Commit

Permalink
Fix bucket keep previous backups issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aminvsf committed Jul 31, 2023
1 parent 40d785c commit 49078ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
__pycache__/
*.py[cod]
*$py.class
modules.xml
PostgresBackup.iml
profiles_settings.xml
vcs.xml

# C extensions
*.so
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function upload_postgres_backup_to_s3() {
local SECRET_KEY=""
local BUCKET_NAME=""
local ENDPOINT_URL=""
local BUCKET_KEEP_PREVIOUS_BACKUPS=""

ACCESS_KEY="${!access_keys[i]}"
SECRET_KEY="${!secret_keys[i]}"
Expand All @@ -145,7 +146,7 @@ function upload_postgres_backup_to_s3() {
echo "[INFO] Uploading backup to S3 bucket $((i+1)) ..."

local backup_name=""
if [[ "$BUCKET_KEEP_PREVIOUS_BACKUPS" == "true" ]]; then
if [ "$BUCKET_KEEP_PREVIOUS_BACKUPS" ]; then
backup_name="backup_$NOW.sql"
else
backup_name="backup.sql"
Expand Down

0 comments on commit 49078ab

Please sign in to comment.