From 6b51734bbf33e82d3723ed7e5de136f212c19b21 Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Thu, 7 Nov 2019 22:48:56 +0000 Subject: [PATCH] added the ability to change the filename prefix --- db_scripts/db_dump | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db_scripts/db_dump b/db_scripts/db_dump index c9a8e76..5a2333e 100644 --- a/db_scripts/db_dump +++ b/db_scripts/db_dump @@ -1,6 +1,7 @@ #! /bin/bash -NAME=${1:-postgres} -BUCKET=${2:-wubloader-db} +PREFIX=${1:-wubloader} +NAME=${2:-postgres} +BUCKET=${3:-wubloader-db} CONTAINER=$(docker ps --format "{{.Names}}" | grep "$NAME") if [ -z "$CONTAINER" ]; then echo "Container not found" @@ -11,6 +12,6 @@ if [ "$(wc -l <<<"$CONTAINER")" -ne 1 ]; then exit 1 fi -FILE="wubloader-$(date +%Y-%m-%dT%H:%M:%S).sql" +FILE="$PREFIX-$(date +%Y-%m-%dT%H:%M:%S).sql" echo "Dumping $CONTAINER to $FILE" docker exec $CONTAINER pg_dump wubloader -U postgres | aws s3 cp - "s3://$BUCKET/$FILE"