Skip to content

Commit

Permalink
Fix variables unpack errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nkiryanov committed Feb 27, 2024
1 parent ddba151 commit 1fc3533
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /bin/sh

# shellcheck disable=SC3040 # expecting 'pipefail' derrictive is availabe in the shell
# shellcheck disable=SC2086 # POSTGRES_HOST_OPTS and AWS_ARGS should be splitted by spaces intentionally

set -e
set -o pipefail
Expand Down Expand Up @@ -61,11 +62,11 @@ POSTGRES_HOST_OPTS="-h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER $POSTG

echo "Creating dump of $POSTGRES_DATABASE database from $POSTGRES_HOST..."

pg_dump -Fc "$POSTGRES_HOST_OPTS" "$POSTGRES_DATABASE" > db.dump
pg_dump -Fc $POSTGRES_HOST_OPTS "$POSTGRES_DATABASE" > db.dump

echo "Uploading dump to $S3_BUCKET"

aws "$AWS_ARGS" s3 cp db.dump "s3://$S3_BUCKET/$S3_PREFIX/$POSTGRES_DATABASE_$(date +"%Y-%m-%dT%H:%M:%SZ").dump" || exit 2
aws $AWS_ARGS s3 cp db.dump "s3://$S3_BUCKET/$S3_PREFIX/${POSTGRES_DATABASE}_$(date +"%Y-%m-%dT%H:%M:%SZ").dump" || exit 2

echo "DB backup uploaded successfully"

Expand Down

0 comments on commit 1fc3533

Please sign in to comment.