From 5cc6cad3cc94071fd09ee1ea7371a3db53b68b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Szurmak?= Date: Wed, 6 Mar 2019 20:30:53 +0100 Subject: [PATCH] Print backup filename to console --- postgres-backup-s3/backup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/postgres-backup-s3/backup.sh b/postgres-backup-s3/backup.sh index e37273c..47a79a6 100644 --- a/postgres-backup-s3/backup.sh +++ b/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"