Обсуждение: unattended backupscript not working with 7.4.2, works in 7.1
unattended backupscript not working with 7.4.2, works in 7.1
От
"Development - multi.art.studio"
Дата:
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
On Mon, May 03, 2004 at 03:42:04AM +0200, Development - multi.art.studio wrote: > 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 I think the difference is that the programs don't read the password from stdin anymore; rather they expect it on /dev/tty. Maybe you could use the ~/.pgpass file instead; read its documentation in the libpq section of the manual. -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "Nadie esta tan esclavizado como el que se cree libre no siendolo" (Goethe)
"Development - multi.art.studio" <dev.null@multiartstudio.com> writes: > after updating some of my databases, everything works fine, except my > backupscripts. > any suggestions? Set up a ~/.pgpass file for the account that's running the backup job. Or switch to a non-password-based authentication mechanism. regards, tom lane