Thread: trouble with pg_dumpall
Hi Everybody,
I started running 8.3.0 recently on dell hardware
with redhat advanced server 4.
I have a problem with pg_dumpall via crontab.
I had a simple crontab to do the same thing on
8.2.4 and the same thing doesn't work.
Here's my very simple crontab entry:
xx xx * * * sh /usr/local/pgsql/cron_dir/moo.sh
and moo.sh is eqally simple:
#! /bin/bash
. .bashrc
filename=`date +%G%m%d.%w`.gz
/usr/local/pgsql/bin/pg_dumpall > $filename
Here's what I get back as output is:
Password:
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
This is not what happened on 8.2.4. I read 8.3.0 man
page on pg_dumpall. Here's what it told me:
The file .pgpass in a user's home directory or the file referenced
by PGPASSFILE can contain passwords to be used if the connection
requires a password (and no password has been specified otherwise).
I have .pgpass in /usr/local/pgsql and when I type
psql dbname
It lets me in without asking the password. So I don't
understand why I get what I get: fe_sendauth: no password supplied
I ran a different cron job which looks like:
#! /bin/bash
. .bashrc
echo PGUSER: $PGUSER
echo PGDATABASE: $PGDATABASE
echo PGHOST: $PGHOST
echo PGPASSFILE: $PGPASSFILE
echo PGDATA: $PGDATA
and everything it told me checks out with what I get from
interactive session.
Please tell me what I am doing wrong. I am at the
end of my wits.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
Try explicitly setting those variables in your script: $PGUSER $PGDATABASE $PGHOST $PGPASSFILE $PGDATA THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail.
Hi Phillip,
Thank you for your suggestion. So my script
file now looks like:
#! /bin/bash
PGUSER=postgres
PGDATABASE=canon
PGHOST=vixen
PGPASSFILE=winkwink
PGDATA=/usr/local/pgsql/data
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export PGUSER PGDATABASE PGHOST PGPASSFILE PGDATA LD_LIBRARY_PATH
# echo +++++++++
# echo PGUSER: $PGUSER
# echo PGDATABASE: $PGDATABASE
# echo PGHOST: $PGHOST
# echo PGPASSFILE: $PGPASSFILE
# echo PGDATA: $PGDATA
filename=`date +%G%m%d.%w`.gz
/usr/local/pgsql/bin/pg_dumpall > $filename
and I still get the same output:
Password:
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
I just don't get it...
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Phillip Smith [mailto:phillip.smith@weatherbeeta.com.au]
Sent: Wed 2/27/2008 5:19 PM
To: Tena Sakai; pgsql-admin@postgresql.org
Subject: RE: [ADMIN] trouble with pg_dumpall
Try explicitly setting those variables in your script:
$PGUSER
$PGDATABASE
$PGHOST
$PGPASSFILE
$PGDATA
THINK BEFORE YOU PRINT - Save paper if you don't really need to print this
*******************Confidentiality and Privilege Notice*******************
The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.
Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.
Hi Everybody,
I have turned every stone over and I am
pretty close to convince myself that the
way I am doing doesn't work. I can't
believe I am the one to discover such a
bug. I would love to hear somebody prove
me wrong.
But in the meantime, maybe I will take a
bit different approach. Namely:
Is there anyway I can pass the password to
pg_dumpall via crontab?
Maybe via argv? Then I would be able to
say via crontab entry:
xx xx * * * bash /usr/local/pgsql/cronbase/moo.sh "password!"
Of course, what I am stating above doesn't work.
I am asking if you have any suggestion in a
similar fashion.
I am all ears.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: pgsql-admin-owner@postgresql.org on behalf of Tena Sakai
Sent: Wed 2/27/2008 5:40 PM
To: Phillip Smith; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] trouble with pg_dumpall
Hi Phillip,
Thank you for your suggestion. So my script
file now looks like:
#! /bin/bash
PGUSER=postgres
PGDATABASE=canon
PGHOST=vixen
PGPASSFILE=winkwink
PGDATA=/usr/local/pgsql/data
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export PGUSER PGDATABASE PGHOST PGPASSFILE PGDATA LD_LIBRARY_PATH
# echo +++++++++
# echo PGUSER: $PGUSER
# echo PGDATABASE: $PGDATABASE
# echo PGHOST: $PGHOST
# echo PGPASSFILE: $PGPASSFILE
# echo PGDATA: $PGDATA
filename=`date +%G%m%d.%w`.gz
/usr/local/pgsql/bin/pg_dumpall > $filename
and I still get the same output:
Password:
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
I just don't get it...
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Phillip Smith [mailto:phillip.smith@weatherbeeta.com.au]
Sent: Wed 2/27/2008 5:19 PM
To: Tena Sakai; pgsql-admin@postgresql.org
Subject: RE: [ADMIN] trouble with pg_dumpall
Try explicitly setting those variables in your script:
$PGUSER
$PGDATABASE
$PGHOST
$PGPASSFILE
$PGDATA
THINK BEFORE YOU PRINT - Save paper if you don't really need to print this
*******************Confidentiality and Privilege Notice*******************
The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.
Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.
Can you post your pg_hba.conf file to the list please? THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, 27 Feb 2008 18:26:54 -0800 "Tena Sakai" <tsakai@gallo.ucsf.edu> wrote: > But in the meantime, maybe I will take a > bit different approach. Namely: > > Is there anyway I can pass the password to > pg_dumpall via crontab? You can use a pgpass file as the user calling the cron. http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html Or you can use PGPASSWORD="foo" But that can be dangerous. Joshua D. Drake - -- The PostgreSQL Company since 1997: http://www.commandprompt.com/ PostgreSQL Community Conference: http://www.postgresqlconference.org/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL SPI Liaison | SPI Director | PostgreSQL political pundit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHxh2tATb/zqfZUUQRAoTWAKCD7dgA5pSlDcu3xTWvei4K/KFqxACfQbVq dJvLDR1LKM6yt2RyewQfNQI= =y55x -----END PGP SIGNATURE-----
Hi Phiilip,
Here it is.
Tena
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file. A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTION]
# host DATABASE USER CIDR-ADDRESS METHOD [OPTION]
# hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
# hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask. Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "crypt", "password",
# "krb5", "ident", "pam" or "ldap". Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTION is the ident map or the name of the PAM service, depending on METHOD.
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can use
# "pg_ctl reload" to do that.
# Put your actual configuration here
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# host all donder 172.16.1.107/32 ldap ldap://amarula.egcrc.org
# host all donder 172.16.1.107/32 ldap ldap://amarula.egcrc.org/dc=egcrc,dc=org;amarula\
local all +analysis md5
local all +wetlab md5
local all +adm md5
local all +contractors md5
local all gadb md5
local all donder md5
local all tsakai md5
local all gbrush md5
local all postgres md5
### local all all trust
# local sameuser +contractors trust
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#
# CAUTION: Configuring the system for local "trust" authentication allows
# any local user to connect as any PostgreSQL user, including the database
# superuser. If you do not trust all your local users, use another
# authentication method.
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
### local all all trust
host canon gjoslyn 172.16.0.110/32 md5
host canon gbrush 172.16.0.106/32 md5
host canon all 172.16.0.0/22 md5 # tws, 20071001
host canon all 172.16.1.106/32 md5 # blitzen
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
-----Original Message-----
From: pgsql-admin-owner@postgresql.org on behalf of Phillip Smith
Sent: Wed 2/27/2008 6:32 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] trouble with pg_dumpall
Can you post your pg_hba.conf file to the list please?
THINK BEFORE YOU PRINT - Save paper if you don't really need to print this
*******************Confidentiality and Privilege Notice*******************
The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.
Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
On Wed, 27 Feb 2008, Tena Sakai wrote: > Hi Jeff, > > Thanks for your reply, but I think you might > have missed an earlier thread. I am afraid > I have tried what you suggest. Below's my > previous post. > > > filename=`date +%G%m%d.%w`.gz > /usr/local/pgsql/bin/pg_dumpall > $filename > > Here's what I get back as output is: > > Password: > pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied > > This is not what happened on 8.2.4. I read 8.3.0 man > page on pg_dumpall. Here's what it told me: > > The file .pgpass in a user's home directory or the file referenced > by PGPASSFILE can contain passwords to be used if the connection > requires a password (and no password has been specified otherwise). > > I have .pgpass in /usr/local/pgsql and when I type > psql dbname > It lets me in without asking the password. So I don't > understand why I get what I get: fe_sendauth: no password supplied > Please reply-all and don't top-post. :-) I bet the $HOME environment variable isn't being set by your cron implementation. Is this gentoo perhaps? Try putting an echo $HOME in your script and see if it's defined. -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
On Wed, 27 Feb 2008, Tena Sakai wrote: > I have turned every stone over and I am > pretty close to convince myself that the > way I am doing doesn't work. I can't > believe I am the one to discover such a > bug. I would love to hear somebody prove > me wrong. > > But in the meantime, maybe I will take a > bit different approach. Namely: > > Is there anyway I can pass the password to > pg_dumpall via crontab? > > Maybe via argv? Then I would be able to > say via crontab entry: > > xx xx * * * bash /usr/local/pgsql/cronbase/moo.sh "password!" > > Of course, what I am stating above doesn't work. > I am asking if you have any suggestion in a > similar fashion. > > I am all ears. Just use the .pgpass file. Here's the documentation page for 8.2: http://www.postgresql.org/docs/8.2/static/libpq-pgpass.html -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
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
> Is this gentoo perhaps?
It is Redhat Advanced Server 4 on Dell hardware.
Regards,
Tena
-----Original Message-----
From: Jeff Frost [mailto:jeff@frostconsultingllc.com]
Sent: Wed 2/27/2008 6:59 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: RE: [ADMIN] trouble with pg_dumpall
On Wed, 27 Feb 2008, Tena Sakai wrote:
> Hi Jeff,
>
> Thanks for your reply, but I think you might
> have missed an earlier thread. I am afraid
> I have tried what you suggest. Below's my
> previous post.
>
>
> filename=`date +%G%m%d.%w`.gz
> /usr/local/pgsql/bin/pg_dumpall > $filename
>
> Here's what I get back as output is:
>
> Password:
> pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
>
> This is not what happened on 8.2.4. I read 8.3.0 man
> page on pg_dumpall. Here's what it told me:
>
> The file .pgpass in a user's home directory or the file referenced
> by PGPASSFILE can contain passwords to be used if the connection
> requires a password (and no password has been specified otherwise).
>
> I have .pgpass in /usr/local/pgsql and when I type
> psql dbname
> It lets me in without asking the password. So I don't
> understand why I get what I get: fe_sendauth: no password supplied
>
Please reply-all and don't top-post. :-)
I bet the $HOME environment variable isn't being set by your cron
implementation. Is this gentoo perhaps? Try putting an echo $HOME in your
script and see if it's defined.
--
Jeff Frost, Owner <jeff@frostconsultingllc.com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
On Wed, 27 Feb 2008 17:12:40 -0800 "Tena Sakai" <tsakai@gallo.ucsf.edu> wrote: Here's your problem. > . .bashrc You have an extremely minimal environment when running from cron, and you certainly *aren't* running from the home directoryof the relevant user. You need to set up your PATH and HOME manually, and cd to your home directory before sourcing.bashrc for this to work. . ~/.bashrc *might* work, but it's better to be specific (: hth, Steve -- Steve Holdoway <steve.holdoway@firetrust.com>
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@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
Hi Steve,
I have changed my script to:
#! /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
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
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 here's the result:
+++++++++
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
As you can see, I am afraid my point still holds.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: pgsql-admin-owner@postgresql.org on behalf of Steve Holdoway
Sent: Wed 2/27/2008 7:33 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] trouble with pg_dumpall
On Wed, 27 Feb 2008 17:12:40 -0800
"Tena Sakai" <tsakai@gallo.ucsf.edu> wrote:
Here's your problem.
> . .bashrc
You have an extremely minimal environment when running from cron, and you certainly *aren't* running from the home directory of the relevant user. You need to set up your PATH and HOME manually, and cd to your home directory before sourcing .bashrc for this to work.
. ~/.bashrc *might* work, but it's better to be specific (:
hth,
Steve
--
Steve Holdoway <steve.holdoway@firetrust.com>
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
On Wed, 27 Feb 2008, Tena Sakai wrote: > +++++++++ > 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 Hey Tena, What user is this script running as when running under cron? Might be time to break out strace and run it like this: strace -fe trace=file /usr/local/pgsql/bin/pg_dumpall > $filename 2> strace.out > > As you can see, I am afraid my point still holds. > > Regards, > > Tena Sakai > tsakai@gallo.ucsf.edu > > > -----Original Message----- > From: pgsql-admin-owner@postgresql.org on behalf of Steve Holdoway > Sent: Wed 2/27/2008 7:33 PM > To: pgsql-admin@postgresql.org > Subject: Re: [ADMIN] trouble with pg_dumpall > > On Wed, 27 Feb 2008 17:12:40 -0800 > "Tena Sakai" <tsakai@gallo.ucsf.edu> wrote: > > Here's your problem. >> . .bashrc > > You have an extremely minimal environment when running from cron, and you certainly *aren't* running from the home directoryof the relevant user. You need to set up your PATH and HOME manually, and cd to your home directory before sourcing.bashrc for this to work. > > . ~/.bashrc *might* work, but it's better to be specific (: > > hth, > > Steve > > -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
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@gallo.ucsf.edu
-----Original Message-----
From: Jeff Frost [mailto:jeff@frostconsultingllc.com]
Sent: Wed 2/27/2008 7:41 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.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@frostconsultingllc.com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
> -----Original Message----- > From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Tena Sakai > Sent: Thursday, 28 February 2008 15:05 > To: Steve Holdoway; pgsql-admin@postgresql.org > Subject: Re: [ADMIN] trouble with pg_dumpall > > As you can see, I am afraid my point still holds. Try adding this to your script after the echo PATH: $PATH line, just for debugging purposes: /bin/echo "|----------|" if [ -f ~/.pgpass ] ; then /bin/cat ~/.pgpass else /bin/echo ".pgpass missing" fi /bin/echo "|----------|" THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail.
On Wed, 27 Feb 2008, Tena Sakai wrote: > Hi Jeff, > > You cuaght me with a fine point. > >> but I didn't see HOME being exported. > > I have changed the script accordingly: > > And the result/my claim remains the same as before: > > 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. I didn't really expect that to make a difference. What does your .pgpass look like? What OS user are you running the cron job as? Do you have SELINUX enabled? Can you run the script with the strace command I sent in a previous email so that we can see what's really going on? -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
Hi Jeff,
> What does your .pgpass look like?
*:5432:canon:postgres:winkwink
> What OS user are you running the cron job as?
User postgres.
> Do you have SELINUX enabled?
I have no idea what SELINUX is.
> Can you run the script with the strace command
> I sent in a previous email so that we can see
> what's really going on?
Yes, it is running and I expect it to go for another
10 to 15 minutes. I will get your the result asap.
Thank you for your invariable assistance.
I am getting excited.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Jeff Frost [mailto:jeff@frostconsultingllc.com]
Sent: Wed 2/27/2008 8:32 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: RE: [ADMIN] trouble with pg_dumpall
On Wed, 27 Feb 2008, Tena Sakai wrote:
> Hi Jeff,
>
> You cuaght me with a fine point.
>
>> but I didn't see HOME being exported.
>
> I have changed the script accordingly:
>
> And the result/my claim remains the same as before:
>
> 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.
I didn't really expect that to make a difference. What does your .pgpass look
like? What OS user are you running the cron job as? Do you have SELINUX
enabled? Can you run the script with the strace command I sent in a previous
email so that we can see what's really going on?
--
Jeff Frost, Owner <jeff@frostconsultingllc.com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
On Wed, 27 Feb 2008, Tena Sakai wrote: > Hi Jeff, > >> What does your .pgpass look like? > *:5432:canon:postgres:winkwink There's the problem. That says, any host, port 5432, canon database, postgres user, password. But pg_dumpall needs to connect to all the databases including template1 and postgres DBs. Change the 'canon' to '*' and I bet it will be fine. > >> What OS user are you running the cron job as? > User postgres. > >> Do you have SELINUX enabled? > I have no idea what SELINUX is. cat /etc/selinux/config > >> Can you run the script with the strace command >> I sent in a previous email so that we can see >> what's really going on? > Yes, it is running and I expect it to go for another > 10 to 15 minutes. I will get your the result asap. > > Thank you for your invariable assistance. > I am getting excited. > > Regards, > > Tena Sakai > tsakai@gallo.ucsf.edu > > > -----Original Message----- > From: Jeff Frost [mailto:jeff@frostconsultingllc.com] > Sent: Wed 2/27/2008 8:32 PM > To: Tena Sakai > Cc: pgsql-admin@postgresql.org > Subject: RE: [ADMIN] trouble with pg_dumpall > > On Wed, 27 Feb 2008, Tena Sakai wrote: > >> Hi Jeff, >> >> You cuaght me with a fine point. >> >>> but I didn't see HOME being exported. >> >> I have changed the script accordingly: >> >> And the result/my claim remains the same as before: >> >> 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. > > I didn't really expect that to make a difference. What does your .pgpass look > like? What OS user are you running the cron job as? Do you have SELINUX > enabled? Can you run the script with the strace command I sent in a previous > email so that we can see what's really going on? > > -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
Hi Phillip,
I wish I thought of the same thing What
a fine idea! And here's the result:
+++++++++
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:.
|----------|
*:5432:canon:postgres:mysecret
|----------|
Password:
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: pgsql-admin-owner@postgresql.org on behalf of Phillip Smith
Sent: Wed 2/27/2008 8:31 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] trouble with pg_dumpall
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Tena Sakai
> Sent: Thursday, 28 February 2008 15:05
> To: Steve Holdoway; pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] trouble with pg_dumpall
>
> As you can see, I am afraid my point still holds.
Try adding this to your script after the echo PATH: $PATH line, just for
debugging purposes:
/bin/echo "|----------|"
if [ -f ~/.pgpass ] ; then
/bin/cat ~/.pgpass
else
/bin/echo ".pgpass missing"
fi
/bin/echo "|----------|"
THINK BEFORE YOU PRINT - Save paper if you don't really need to print this
*******************Confidentiality and Privilege Notice*******************
The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.
Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments
e-mail.
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
> +++++++++ > 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/b in:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/ant/bin:. > |----------| > *:5432:canon:postgres:mysecret > |----------| > Password: > pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied As Jeff said, that's your problem... Change 'canon' to '*' and it should be fine :) THINK BEFORE YOU PRINT - Save paper if you don't really need to print this *******************Confidentiality and Privilege Notice******************* The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email. Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments e-mail.
Yeeeeha!
That did, Jeff! Fantastic!
*:5432:canon:postgres:winkwink <- no good
*:5432:*:postgres:winkwink <- works!
Many thanks to Jeff and everybody else who
stayed with me to see the end of this saga.
I appreciate it wholeheartedly.
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Jeff Frost [mailto:jeff@frostconsultingllc.com]
Sent: Wed 2/27/2008 8:45 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: RE: [ADMIN] trouble with pg_dumpall
On Wed, 27 Feb 2008, Tena Sakai wrote:
> Hi Jeff,
>
>> What does your .pgpass look like?
> *:5432:canon:postgres:winkwink
There's the problem. That says, any host, port 5432, canon database, postgres
user, password. But pg_dumpall needs to connect to all the databases
including template1 and postgres DBs. Change the 'canon' to '*' and I bet it
will be fine.
>
>> What OS user are you running the cron job as?
> User postgres.
>
>> Do you have SELINUX enabled?
> I have no idea what SELINUX is.
cat /etc/selinux/config
>
>> Can you run the script with the strace command
>> I sent in a previous email so that we can see
>> what's really going on?
> Yes, it is running and I expect it to go for another
> 10 to 15 minutes. I will get your the result asap.
>
> Thank you for your invariable assistance.
> I am getting excited.
>
> Regards,
>
> Tena Sakai
> tsakai@gallo.ucsf.edu
>
>
> -----Original Message-----
> From: Jeff Frost [mailto:jeff@frostconsultingllc.com]
> Sent: Wed 2/27/2008 8:32 PM
> To: Tena Sakai
> Cc: pgsql-admin@postgresql.org
> Subject: RE: [ADMIN] trouble with pg_dumpall
>
> On Wed, 27 Feb 2008, Tena Sakai wrote:
>
>> Hi Jeff,
>>
>> You cuaght me with a fine point.
>>
>>> but I didn't see HOME being exported.
>>
>> I have changed the script accordingly:
>>
>> And the result/my claim remains the same as before:
>>
>> 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.
>
> I didn't really expect that to make a difference. What does your .pgpass look
> like? What OS user are you running the cron job as? Do you have SELINUX
> enabled? Can you run the script with the strace command I sent in a previous
> email so that we can see what's really going on?
>
>
--
Jeff Frost, Owner <jeff@frostconsultingllc.com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954