From cd1687ee3b3d981dd37fa6512addc2d71118e50a Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Wed, 20 Sep 2023 14:46:30 +0200 Subject: [PATCH] FIX could not change directory to "/root" --- plugins/localdump/pgsql.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plugins/localdump/pgsql.sh b/plugins/localdump/pgsql.sh index 4aa4b54..cff5ec1 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 - } -- GitLab