Skip to content
Snippets Groups Projects

pgsql.backup - no subshell to fetch backup status

Merged Hahn Axel (hahn) requested to merge pgsql-snapshot-fallback into master
1 file
+ 49
50
Compare changes
  • Side-by-side
  • Inline
+ 49
50
@@ -56,7 +56,6 @@ function pgsql.backup(){
# ----- GO
# prevent could not change directory to "/root": Permission denied
(
cd /tmp
# Detect a readonly or writeable postgres host.
@@ -89,8 +88,8 @@ function pgsql.backup(){
if [ $bUseSnapshot4DB -eq 1 ]; then
echo -n " snapshot ... "
su ${PGUSER} -c "dropdb ${SNAPSHOTDB}" >/dev/null 2>&1
if ! su ${PGUSER} -c "psql ${BACKUP_PARAMS} -c \"CREATE DATABASE ${SNAPSHOTDB} WITH TEMPLATE ${DATABASE};\"" >/dev/null 2>&1; then
echo -n " nope, using origin ... "
if ! su ${PGUSER} -c "psql ${BACKUP_PARAMS} -c \"CREATE DATABASE ${SNAPSHOTDB} WITH TEMPLATE ${DATABASE};\"" >/dev/null; then
echo -n "Fallback using origin ... "
bUseSnapshot4DB=0
SNAPSHOTDB="${DATABASE}"
fi
@@ -115,7 +114,7 @@ function pgsql.backup(){
fi
done
)
cd - >/dev/null
}
Loading