annotate scripts/restore-usps.sh @ 27:d8c2d819e814

add usps restore script
author Dave smith <smith@nwoca.org>
date Mon, 18 Jan 2016 15:21:45 -0500
parents
children 443aa0be3f09
rev   line source
27
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
1
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
2 f [ -z "$1" ]
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
3 then
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
4 echo "Usage: `basename $0` {backup file to restore}"
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
5 echo " filename must relative to the container's file system. (e.g. /backup/filename)"
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
6 exit $E_NOARGS
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
7 fi
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
8
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
9 docker-compose stop uspsapp
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
10 docker-compose run --rm uspsdb sh -c \
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
11 "gunzip -f $1 -c | psql --host=uspsdb \
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
12 --dbname=\$USPSDB_ENV_DB_NAME \
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
13 --username=\$USPSDB_ENV_DB_USER"
d8c2d819e814 add usps restore script
Dave smith <smith@nwoca.org>
parents:
diff changeset
14 docker-compose stop uspsapp