mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 13:23:12 +01:00
Postgres backup fixes
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
## 1.13 - 2019-03-09 - <dave at tiredofit dot ca>
|
||||
|
||||
* Fixed Postgres backup without SPLIT_DB enabled (credit MelwinKfr@github)
|
||||
* Added DB_PORT reference to properly backup Postgres with non default ports (thanks Maxximus007@github)
|
||||
|
||||
## 1.12 - 2019-03-01 - <stevetodorov at github>
|
||||
|
||||
* Fix for XZ Compression failing
|
||||
|
||||
@@ -146,7 +146,7 @@ function backup_mongo() {
|
||||
function backup_pgsql() {
|
||||
if [ "$SPLIT_DB" = "TRUE" ] || [ "$SPLIT_DB" = "true" ]; then
|
||||
export PGPASSWORD=${DBPASS}
|
||||
DATABASES=`psql -h $DBHOST -U $DBUSER -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' `
|
||||
DATABASES=`psql -h $DBHOST -U $DBUSER -p ${DBPORT} -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
|
||||
@@ -157,7 +157,7 @@ function backup_pgsql() {
|
||||
done
|
||||
else
|
||||
export PGPASSWORD=${DBPASS}
|
||||
pg_dump -h ${DBHOST} -U ${DBUSER} $db > ${TMPDIR}/${TARGET}
|
||||
pg_dump -h ${DBHOST} -U ${DBUSER} -p ${DBPORT} ${DBNAME} > ${TMPDIR}/${TARGET}
|
||||
generate_md5
|
||||
compression
|
||||
move_backup
|
||||
|
||||
Reference in New Issue
Block a user