comparison scripts/backup-container.sh @ 186:620ea742f1df

DEP-12: add script to execute commands against multiple projects.
author smith@nwoca.org
date Wed, 20 Sep 2017 16:52:37 +0100
parents 303259c08b7d
children 2f5f41d237e7
comparison
equal deleted inserted replaced
185:21eebe9c1a8c 186:620ea742f1df
21 echo "no project available" 21 echo "no project available"
22 exit 1 22 exit 1
23 fi 23 fi
24 24
25 echo "starting backup of $container for $project" 25 echo "starting backup of $container for $project"
26 docker-compose exec $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile} 26 docker-compose exec -t $container sh -c "gosu postgres pg_dump -Cc --if-exists --dbname=$container ; (exit $?) " > ${backupFile}
27 27
28 if [[ $( grep --count "CREATE TABLE" ${backupFile} ) -lt 200 || $( grep --count "PostgreSQL database dump complete" ${backupFile} ) -eq 0 ]]; then 28 if [[ $( grep --count "CREATE TABLE" ${backupFile} ) -lt 200 || $( grep --count "PostgreSQL database dump complete" ${backupFile} ) -eq 0 ]]; then
29 echo "ERROR: backup verification FAILED" 29 echo "ERROR: backup verification FAILED"
30 echo "ERROR: $(tail ${backupFile})" 30 echo "ERROR: $(tail ${backupFile})"
31 exit 1 31 exit 1