Re: trouble with pg_dumpall

From: "Tena Sakai" <tsakai(at)gallo(dot)ucsf(dot)edu>
To: "Jeff Frost" <jeff(at)frostconsultingllc(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: trouble with pg_dumpall
Date: 2008-02-28 04:29:18
Message-ID: FE44E0D7EAD2ED4BB2165071DB8E328C0378F0E0@egcrc-ex01.egcrc.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)gallo(dot)ucsf(dot)edu

-----Original Message-----
From: Jeff Frost [mailto:jeff(at)frostconsultingllc(dot)com]
Sent: Wed 2/27/2008 7:41 PM
To: Tena Sakai
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] 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(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Phillip Smith 2008-02-28 04:31:53 Re: trouble with pg_dumpall
Previous Message Jeff Frost 2008-02-28 04:26:30 Re: trouble with pg_dumpall