added the ability to change the filename prefix

mike/testing
Christopher Usher 5 years ago
parent 1325ccf280
commit 6b51734bbf

@ -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"

Loading…
Cancel
Save