dump_postgresql_per_base: return if postgresql directory is missing

This commit is contained in:
Jérémy Lecour 2024-11-06 16:30:39 +01:00 committed by Jérémy Lecour
parent a9d90fc937
commit a791d752f0
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY
2 changed files with 4 additions and 1 deletions

View file

@ -23,6 +23,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* dump_redis: do not delete entire backup directory
* dump_redis: clean backup directory only if the Redis instance is valid
* dump_postgresql_per_base: return if postgresql directory is missing
### Security

View file

@ -356,8 +356,10 @@ dump_postgresql_per_base() {
fi
fi
cd /var/lib/postgresql
cd /var/lib/postgresql || { log "LOCAL_TASKS - ${FUNCNAME[0]}: /var/lib/postgresql not found"; return; }
databases=$(sudo -u postgres psql -U postgres ${connect_options[*]} -lt | awk -F \| '{print $1}' | grep -v "template.*")
for database in ${databases} ; do
local error_file="${errors_dir}/${database}.err"
local dump_file="${dump_dir}/${database}.sql${dump_ext}"