comparison scripts/restore-usps.sh @ 28:443aa0be3f09

update backup/restore scripts
author smith@nwoca.org
date Mon, 18 Jan 2016 21:28:26 +0000
parents d8c2d819e814
children b4ea91a25193
comparison
equal deleted inserted replaced
27:d8c2d819e814 28:443aa0be3f09
1 1
2 f [ -z "$1" ] 2 if [ -z "$1" ]
3 then 3 then
4 echo "Usage: `basename $0` {backup file to restore}" 4 echo "Usage: `basename $0` {backup file to restore}"
5 echo " filename must relative to the container's file system. (e.g. /backup/filename)" 5 echo " filename must relative to the container's file system. (e.g. /backup/filename)"
6 exit $E_NOARGS 6 exit $E_NOARGS
7 fi 7 fi
8 8
9 docker-compose stop uspsapp 9 docker-compose stop uspsapp
10 docker-compose restart uspsdb
10 docker-compose run --rm uspsdb sh -c \ 11 docker-compose run --rm uspsdb sh -c \
11 "gunzip -f $1 -c | psql --host=uspsdb \ 12 "gunzip -f $1 -c | psql --host=uspsdb --username=postgres"
12 --dbname=\$USPSDB_ENV_DB_NAME \ 13 docker-compose start uspsapp
13 --username=\$USPSDB_ENV_DB_USER"
14 docker-compose stop uspsapp 14 docker-compose stop uspsapp