Hi Jeff,
You cuaght me with a fine point.
> but I didn't see HOME being exported.
I have changed the script accordingly:
#! /bin/bash
PATH=/usr/local/pgsql/bin:/bin:/usr/kerberos/bin:/usr/local/java/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/ant/bin:.
PGHOME=/usr/local/pgsql
HOME=/usr/local/pgsql
PGUSER=postgres
PGDATABASE=canon
PGHOST=localhost
PGPASSFILE=/usr/local/pgsql/.pgpass
PGDATA=/usr/local/pgsql/data
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export PGUSER PGDATABASE PGHOST PGPASSFILE PGDATA LD_LIBRARY_PATH
export PGHOME PATH HOME
echo +++++++++
echo PGUSER: $PGUSER
echo PGDATABASE: $PGDATABASE
echo PGHOST: $PGHOST
echo PGPASSFILE: $PGPASSFILE
echo PGDATA: $PGDATA
echo HOME: $HOME
echo PATH: $PATH
filename=`date +%G%m%d.%w`.gz
/usr/local/pgsql/bin/pg_dumpall > $filename
And the result/my claim remains the same as before:
+++++++++
PGUSER: postgres
PGDATABASE: canon
PGHOST: localhost
PGPASSFILE: /usr/local/pgsql/.pgpass
PGDATA: /usr/local/pgsql/data
HOME: /usr/local/pgsql
PATH: /usr/local/pgsql/bin:/bin:/usr/kerberos/bin:/usr/local/java/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/ant/bin:.
Password:
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
I see just one more option. Namely, to change the
postgres user entry for pg_hba.conf to "trust" for
a short period as pg_dumpall starts and then put it
back to the way normally is (md5). I would rather
not do that and get .pgpass or PGPASSFILE to work
for me.
Regards,
Tena Sakai
tsakai@xxxxxxxxxxxxxx
-----Original Message-----
From: Jeff Frost [mailto:jeff@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Wed 2/27/2008 7:41 PM
To: Tena Sakai
Cc: pgsql-admin@xxxxxxxxxxxxxx
Subject: Re: trouble with pg_dumpall
On Wed, 27 Feb 2008, Tena Sakai wrote:
> Hi Jeff,
>
>> I bet the $HOME environment variable isn't
>> being set by your cron implementation.
>> Try putting an echo $HOME in your script and
>> see if it's defined.
>
> I did. Here's the result:
>
> +++++++++
> PGUSER: postgres
> PGDATABASE: canon
> PGHOST: localhost
> PGPASSFILE: /usr/local/pgsql/.pgpass
> PGDATA: /usr/local/pgsql/data
> +++++++++
> HOME: /usr/local/pgsql
> Password:
> pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
You might need to export the variables and not just set it. I think you're
doing that with the other variables already, but I didn't see HOME being
exported. I've never had to explicitly export these on Redhat derivatives,
so I doubt that's the problem.
What does your .pgpass look like?
I couldn't find it in the message archives.
--
Jeff Frost, Owner <jeff@xxxxxxxxxxxxxxxxxxxxxx>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954