Re: pg_dump - Mailing list pgsql-hackers

From Georgi Chorbadzhiyski
Subject Re: pg_dump
Date
Msg-id 3ECA22E6.4010307@unixsol.org
Whole thread Raw
In response to pg_dump  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
Christopher Kings-Lynne wrote:
> I'm working on trying to get phpPgAdmin to stream the output of pg_dump to
> the user.
> 
> However, it's impossible to set the password!
> 
> I believe it doesn't respect the PGPASS variable anymore, so what do I do?

I think the variable is called PGPASSWORD. Example backup script bellow:

#!/bin/sh

umask 0177

PATH="/bin:/sbin:/usr/bin:/usr/sbin"

TODAY=$(date +%a)
DUMPDIR="/backup/"

echo "DB backup start: `date`"

# Do not suck all CPU time...
renice 20 $$

DATA="pgsql"
PGSQL="/usr/local/pgsql/bin/psql"
PGDUMP="/usr/local/pgsql/bin/pg_dump"
PGUSER="pgsql"
PGPASSWORD="blahblah"
export PGUSER PGPASSWORD

DBTYPE="postgres"
OUT="${DUMPDIR}/${TODAY}/${DBTYPE}"
[ -d ${OUT} ] || mkdir -p ${OUT}

DBS=$($PGSQL -tq -d template1 -c "select datname from pg_database" | \
grep -v template)

for DB in $DBS
do    echo "Dumping postgres db: $DB"    $PGDUMP -D $DB -Z 5 -f $OUT/${DB}.sql.gz
done


-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/



pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: Heads up: 7.3.3 this Wednesday
Next
From: Stephan Szabo
Date:
Subject: Re: Heads up: 7.3.3 this Wednesday