diff scripts/backup-container.sh @ 195:26bb64873bbe production v1.3.0

flow: Merged <release> 'v1.3.0' to <master> ('production').
author smith@nwoca.org
date Thu, 21 Sep 2017 17:14:46 +0100
parents 2f5f41d237e7
children fcee81af7e71
line wrap: on
line diff
--- a/scripts/backup-container.sh	Wed Sep 20 16:19:18 2017 +0100
+++ b/scripts/backup-container.sh	Thu Sep 21 17:14:46 2017 +0100
@@ -9,6 +9,10 @@
 #
 container=${1?Must provide container name to backup}
 
+projectDir=${2:-$PWD}
+
+cd $projectDir
+
 source "${SSDT_SCRIPTS:-$(dirname "${BASH_SOURCE[0]}")}/.functions.sh"
 
 set -o pipefail
@@ -23,7 +27,7 @@
 fi
 
 echo "starting backup of $container for $project"
-docker-compose exec $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile}
+docker-compose exec -T $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile}
 
 if [[ $( grep --count "CREATE TABLE" ${backupFile} ) -lt 200 || $( grep --count "PostgreSQL database dump complete" ${backupFile} ) -eq 0 ]]; then
    echo "ERROR: backup verification FAILED"