1.31 - Fix PSQL SPLIT_DB Backup

This commit is contained in:
Dave Conroy
2017-11-16 09:02:39 -08:00
parent 90c2e63ba9
commit 6e8620a587
2 changed files with 6 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
## 1.1 - 2017-11-17 - <dave at tiredofit dot ca>
* Fix to SPLIT_DB Postgresql Backup
## 1.3 - 2017-10-25 - <dave at tiredofit dot ca>
* Remove Alpine postgres package and recompile version 10

View File

@@ -124,12 +124,11 @@ function backup_mongo() {
function backup_pgsql() {
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
DATABASES=$( ${POSTGRES_PASS_STR} psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
export PGPASSWORD=${DBPASS}
DATABASES=psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
for db in $DATABASES; do
echo "** [db-backup] Dumping database: $db"
TARGET=pgsql_${db}_${DBHOST}_${now}.sql
export PGPASSWORD=${DBPASS}
pg_dump -h ${DBHOST} -p ${DBPORT}-U ${DBUSER} $db > ${TMPDIR}/${TARGET}
generate_md5
compression