# HG changeset patch # User smith@nwoca.org # Date 1505923269 -3600 # Node ID 2f5f41d237e78c14c18a40726987a925342e0872 # Parent 6b950e1a95e69b2d1a516ef97a59040e58f7acbf DEP-12: fix backup script. diff -r 6b950e1a95e6 -r 2f5f41d237e7 scripts/backup-container.sh --- 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"