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"