changeset 188:2f5f41d237e7

DEP-12: fix backup script.
author smith@nwoca.org
date Wed, 20 Sep 2017 17:01:09 +0100
parents 6b950e1a95e6
children 1a8087653f2a
files scripts/backup-container.sh
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/backup-container.sh	Wed Sep 20 16:57:30 2017 +0100
+++ b/scripts/backup-container.sh	Wed Sep 20 17:01:09 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 -t $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"