Browse Source

Print backup filename to console

pull/113/head
Przemysław Szurmak 6 years ago
parent
commit
5cc6cad3cc
  1. 6
      postgres-backup-s3/backup.sh

6
postgres-backup-s3/backup.sh

@ -66,8 +66,10 @@ echo "Creating dump of ${POSTGRES_DATABASE} database from ${POSTGRES_HOST}..."
pg_dump $POSTGRES_HOST_OPTS $POSTGRES_DATABASE | gzip > dump.sql.gz
echo "Uploading dump to $S3_BUCKET"
FILENAME=${DB_ENV_PREFIX}_${POSTGRES_DATABASE}_$(date +"%Y-%m-%dT%H_%M_%SZ").sql.gz
cat dump.sql.gz | aws $AWS_ARGS s3 cp - s3://$S3_BUCKET/$S3_PREFIX/${DB_ENV_PREFIX}_${POSTGRES_DATABASE}_$(date +"%Y-%m-%dT%H_%M_%SZ").sql.gz || exit 2
echo "Uploading dump named $FILENAME to $S3_BUCKET"
cat dump.sql.gz | aws $AWS_ARGS s3 cp - s3://$S3_BUCKET/$S3_PREFIX/$FILENAME || exit 2
echo "SQL backup uploaded successfully"
Loading…
Cancel
Save