library/roles/postgresql/files/postgresql-backup.sh: Fix the command line that builds the list of DBs to be backed up.

This commit is contained in:
Andrea Dell'Amico 2017-12-28 17:47:18 +01:00
parent 73cb1d655c
commit 27c8815b25
1 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,8 @@ LOCKFILE=${BACKUPDIR}/.dumplock
umask 0077
if [ "$BUILD_DBLIST" == "yes" ] ; then
# The psql -l command prints too much stuff
DB_LIST=$( psql -q -t -l -U postgres | grep -v template0 | grep -v template1 | grep -v : | grep -v ^\( | grep -v ^\- | awk '{print $1}' )
#DB_LIST=$( psql -q -t -l -U postgres | grep -v template0 | grep -v template1 | grep -v : | grep -v ^\( | grep -v ^\- | awk '{print $1}' )
DB_LIST=$( su - postgres -c "/usr/lib/postgresql/${PG_VERSION}/bin/oid2name " | awk '{print $2}' | tail -n +4 | grep -v template0 | grep -v template1 )
fi
if [ ! -f $LOCKFILE ] ; then