Hello to the List,
i have a question about backing up my fresh updated databases :)
after updating some of my databases, everything works fine, except my
backupscripts.
i run this script as root from cronjob with su - postgres -c "...script..."
it works fine with postgres 7.1, but in 7.4.2 something seems to have
changed on the behaviour of psql, and pg_dump
my pg_hba.conf is as follow, same values in 7.1
local all all password
host all all 0.0.0.0 0.0.0.0 password
my script looks like that:
#! /bin/sh
...
...
PASSWORDFILE=$DBHOME/pass
USERPASSWORDFILE=$DBHOME/user-pass
PORTS="5433 5434"
...
for port in $PORTS; do
export PGPORT=$port
DBs=$($DBHOME/bin/psql -t -c "select datname from pg_database"
template1 <$PASSWORDFILE)
for DB in $DBs; do
mkdir -p $BACKUPDIR/$DB
#sheme backup with createDB
ARCHIVENAME=$DB.$Date.tplC.sql.gz
$DBHOME/bin/pg_dump -x -s -C $DB -u < $USERPASSWORDFILE
| gzip -9 > $BACKUPDIR/$DB/$ARCHIVENAME
echo "$DB:$ARCHIVENAME" >> $LOGFILE
....and so on
as i use pg_dump from 7.1 with my 7.1 databases, script runs without
asking for a password
but when i tried it with 7.4.2 binaries (psql, pg_dump) on my 7.4.2
database then i was asked for a password, and thats not what a cronjob
can answer to ;)
i changed the lines above to use -U postgres and only $PASSWORDFILE for
input, but this doesnt help...
any suggestions?
thanks for reading and comments,
yours sincerely
volker