pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: phoenix.kiula@gmail.com
Cc: PostgreSQL Administration <pgsql-admin@postgresql.org>
Subject: Re: Timestamp in pg_dump output, was Re: How I can know a back up database is up to date
Date: Tue, 14 Aug 2007 12:29:46 -0700 (PDT)
Message-ID: <294750.54841.qm@web31803.mail.mud.yahoo.com> (raw)
In-Reply-To: <1187118160.454574.198870@j4g2000prf.googlegroups.com>

--- phoenix.kiula@gmail.com wrote:
> > If you need to, you can append your own timestamp to the dump file if you need it.
> >
> > I rolled this functionality into a .bat file.
> 
> Hi could you please share how you automated the pg_dump in the command
> line. It seems to always want the password, but I would like to put it
> all in a cronjob, so I would like to specify a password. Can pg_dump
> read from a file of options? The pg_dump page did not seem to suggest
> so. Thanks!

Be sure to include the postgres mailing list so that other can chime in. This is important since
my level of understanding is between novice to intermediate.  So others on this like may offer
better alternatives to my suggestions or may even go as far as correcting my viewpoint on a
particular matter.

Are you running on windows or linux?  

The solution that I've pieced together was designed to mimic on windows the common linux task of
calling shell scripts called by the cron deamon.  In my solution, I use a DOS batch file that is
called by the windows scheduler.  However, for both solutions ( either on linux or windows) to
work you need to have a trusted OS user ( i.e. root / postgres / or Administrator ) call pg_dump
or pg_dumpall and specify a DB user with suffient priveldges like the DB user postgres that have
the rights to access the entire DB/Cluster schema.

The only problem is that by default, all DB user will try to authenticate WITH a password.  There
are two ways to over come this.  The recommended way is to use a .pgpass file which is described
on this link:
http://www.postgresql.org/docs/8.2/static/libpq-pgpass.html

The other method that requires you to restart your server is to modity your pg_hba.conf as add and
entry to allow one of your OS users to log into any/all of you databases without needing a
password.

http://www.postgresql.org/docs/8.2/static/auth-pg-hba-conf.html
http://www.postgresql.org/docs/8.2/static/auth-methods.html#AUTH-TRUST

If you are also interested in developing a shell script or batch file that you can call from a
cron or scheduler, I can provide some ideas if you are enterested.

Regards,
Richard Broersma Jr.





Message-ID: <294750.54841.qm@web31803.mail.mud.yahoo.com>
Permalink:  ../294750.54841.qm@web31803.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/294750.54841.qm@web31803.mail.mud.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: rabroersma@yahoo.com, phoenix.kiula@gmail.com
  Subject: Re: Timestamp in pg_dump output, was Re: How I can know a back up database is up to date
  In-Reply-To: <294750.54841.qm@web31803.mail.mud.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox