Re: pg_dump + cronjob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Nov 06, 2003 at 12:09:26 +0100,
  Gerd Terlutter <gerd@xxxxxxxxx> wrote:
> Hi list,
> i've written a script for dumping several databases (mysql + PG), and it 
> runs fine. But now i have the problem to convert it into a cron script. 
> how can i run pg_dump with password? i found nothing in the manpages 
> about pg login and passwords, e.g. on mysql i can use --password=xxx. 
> any ideas how todo this?

In recent versions you can use a ~/.pgpass file to keep the password.
It is a bad idea to pass passwords on a command line as on most unix
like OS's the argument list can be seen by other people.

If the cron job is running on the same server as postgres, then you
can use either trust or ident authentication for connections over
domain sockets (assuming your OS supports the equivalent of getpeeruid).
ident is probably better to use, but if only trusted users have access
to the box the setup is a little simpler.

The stuff on pgpass seems to be a bit hard to find. It is documented
under libpq rather than for each application that uses libpq.

The following was copied from the 7.4 documentation:

   The file .pgpass in a user's home directory is a file that can contain
   passwords  to  be  used  if the connection requires a password (and no
   password has been specified otherwise). This file should have lines of
   the following format:
hostname:port:database:username:password

   Each  of  the  first  four  fields may be a literal value, or *, which
   matches  anything. The password field from the first line that matches
   the  current  connection  parameters  will  be  used.  (Therefore, put
   more-specific entries first when you are using wildcards.) If an entry
   needs to contain : or \, escape this character with \.


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux