From 1a7d3e6ff1e99ee7d694b76e0d1461578c8c9bc2 Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Thu, 19 Sep 2019 03:19:26 +0100 Subject: [PATCH] script for dumpting the database --- postgres/db_dump | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 postgres/db_dump diff --git a/postgres/db_dump b/postgres/db_dump new file mode 100644 index 0000000..013cdc3 --- /dev/null +++ b/postgres/db_dump @@ -0,0 +1,13 @@ +#! /bin/bash +NAME=${1:-postgres} +CONTAINER=$(docker ps --format "{{.Names}}" | grep "$NAME") +if [ -z "$CONTAINER" ] + then + echo "Container not found" + exit 1 +fi +FILE="wubloader-$(date +%Y-%m-%dT%H:%M:%S).sql" +echo "Dumping $CONTAINER to $FILE" +docker exec $CONTAINER pg_dump wubloader -U postgres > $FILE +aws s3 cp $FILE s3://wubloader-test +rm $FILE