Skip to content

Commit 9051ba5

Browse files
committed
Postgres backup fixes
1 parent bf672c0 commit 9051ba5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.13 - 2019-03-09 - <dave at tiredofit dot ca>
2+
3+
* Fixed Postgres backup without SPLIT_DB enabled (credit MelwinKfr@github)
4+
* Added DB_PORT reference to properly backup Postgres with non default ports (thanks Maxximus007@github)
5+
16
## 1.12 - 2019-03-01 - <stevetodorov at github>
27

38
* Fix for XZ Compression failing

install/etc/s6/services/10-db-backup/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function backup_mongo() {
146146
function backup_pgsql() {
147147
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
148148
export PGPASSWORD=${DBPASS}
149-
DATABASES=`psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' `
149+
DATABASES=`psql -h $DBHOST -U $DBUSER -p ${DBPORT} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' `
150150
for db in $DATABASES; do
151151
echo "** [db-backup] Dumping database: $db"
152152
TARGET=pgsql_${db}_${DBHOST}_${now}.sql
@@ -157,7 +157,7 @@ function backup_pgsql() {
157157
done
158158
else
159159
export PGPASSWORD=${DBPASS}
160-
pg_dump -h ${DBHOST} -U ${DBUSER} $db > ${TMPDIR}/${TARGET}
160+
pg_dump -h ${DBHOST} -U ${DBUSER} -p ${DBPORT} ${DBNAME} > ${TMPDIR}/${TARGET}
161161
generate_md5
162162
compression
163163
move_backup

0 commit comments

Comments
 (0)