dump/postgresql: Fix dump_cmd usage
All checks were successful
gitea/evobackup/pipeline/head This commit looks good

`var="(<cmd>)"; ${var}` doesn't work in shell.
Use "eval" to make it work.
This commit is contained in:
Mathieu Trossevin 2024-07-09 11:20:00 +02:00
parent ba087a2a35
commit 886e47ebf7
Signed by: mtrossevin
GPG key ID: D1DBB7EA828374E9

View file

@ -124,7 +124,7 @@ dump_postgresql_global() {
dump_cmd="(sudo -u postgres pg_dumpall ${dump_options[*]}) 2> ${error_file} | ${compress_cmd} > ${dump_file}"
log "LOCAL_TASKS - ${FUNCNAME[0]}: ${dump_cmd}"
${dump_cmd}
eval "${dump_cmd}"
local last_rc=$?
# shellcheck disable=SC2086
@ -275,7 +275,7 @@ dump_postgresql_per_base() {
dump_cmd="(sudo -u postgres /usr/bin/pg_dump ${dump_options[*]}) 2> ${error_file} | ${compress_cmd} > ${dump_file}"
log "LOCAL_TASKS - ${FUNCNAME[0]}: ${dump_cmd}"
${dump_cmd}
eval "${dump_cmd}"
local last_rc=$?
# shellcheck disable=SC2086