diff --git a/plugins/localdump/pgsql.sh b/plugins/localdump/pgsql.sh index 4aa4b547f36caaea6abdad406cdb5e10dd05e5c7..cff5ec1d7fa0d4a3bac0743975dd14dcba51acda 100755 --- a/plugins/localdump/pgsql.sh +++ b/plugins/localdump/pgsql.sh @@ -12,6 +12,7 @@ # 2017-03-29 ..... v1.1 added restore # 2022-01-20 v1.2 fixes with shellcheck # 2022-03-17 v1.3 WIP: add lines with prefix __DB__ +# 2023-09-20 v1.4 FIX could not change directory to "/root": Permission denied # ================================================================================ if [ -z "$BACKUP_TARGETDIR" ]; then @@ -51,6 +52,8 @@ function doPgsqlBackup(){ # ----- GO + # prevent could not change directory to "/root": Permission denied + cd /tmp sSqlGetDblist="select datname from pg_database where not datistemplate and datallowconn order by datname;" for DATABASE in $(su ${PGUSER} -c "psql -At -c '$sSqlGetDblist' postgres" 2>/dev/null) do @@ -61,18 +64,8 @@ function doPgsqlBackup(){ db._compressDumpfile "$OUTFILE" - # if [ $myrc -eq 0 ]; then - # echo -n "compress ... " - # compress_file "$OUTFILE" - # else - # color error - # echo "ERROR occured - no gzip" - # color reset - # # mv $OUTFILE $OUTFILE - # echo "__DB__$SERVICENAME INFO: backed up ${DATABASE}" - # fi - # ls -l "$OUTFILE"* done + cd - }