Re: Database backup - Mailing list pgsql-admin

From Oliver Elphick
Subject Re: Database backup
Date
Msg-id 1045159082.10910.14.camel@linda.lfix.co.uk
Whole thread Raw
In response to Re: Database backup  (dima <_pppp@mail.ru>)
List pgsql-admin
On Thu, 2003-02-13 at 08:53, dima wrote:
> > I am trying to automate my backups using pg_dump. However, I am not able to
> > pass the password to the command. Has anybody sucessfully done automated
> > backup thru scripts?
> export PGPASSWORD=password && pg_dump ... && export PGPASSWORD=""

Presumably the second export is to conceal PGPASSWORD; it would not be
executed if pg_dump were to fail, because && means execute the following
pipeline only if the previous command succeeds. This should read:

  export PGPASSWORD=password && pg_dump ... ; export PGPASSWORD=""

Better than this is to use ~/.pgpass, which is a new feature in 7.3.
That would not expose the administrator's password to being scanned in
the process table.  Use of ~/.pgpass is described in the libpq manual,
section 1.11

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "The earth is the LORD'S, and the fullness thereof; the
      world, and they that dwell therein."
                                   Psalms 24:1


pgsql-admin by date:

Previous
From: TooManySecrets
Date:
Subject: Auth users and command pg_passwd
Next
From: Bruce Momjian
Date:
Subject: Re: postgresql mysql max connections