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