Skip to content
Snippets Groups Projects
Commit cd1687ee authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

FIX could not change directory to "/root"

parent 40050ca8
Branches
No related tags found
1 merge request!116FIX could not change directory to "/root"
......@@ -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 -
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment