pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lee Harr <missive@frontiernet.net>
To: pgsql-admin@postgresql.org
Subject: Re: Automated database backups and authentication
Date: Tue, 6 Aug 2002 23:32:42 +0000 (UTC)
Message-ID: <aipmap$1afd$2@news.hub.org> (raw)
References: <20020806181501.58BFD475835@postgresql.org>

> I would like to backup a set of databases from a cron job. It looks like 
> pg_dumpall will do the trick. The only problem is that there doesn't seem to 
> be any way to pass the database password to pg_dumpall in a non interactive 
> manner. I'd like to use some kind of access control on the databases, but it 
> would need to be able to function non interactively.
> 
> Ideally whatever I do would be able to function across a network, so that one 
> database server could backup to a second - kind of a poor man's replication.
> 
> I haven't found any real answers in any of the archives, or docs. Has anyone 
> here done something like this or have any thoughts?
> 


I just set this up on my system.

I use expect to take the backups and transfer the files to
another system using scp. I also use some python scripts
to figure out what the names of the backup files should
be (using the date for instance).

Some issues I ran into:

* Since the password will be in the expect script, you need
  to be careful with permissions on the script.

* Also, watch your umask for any temporary files you may
  create in the process.

* Expect scripts which run fine from the command line will
  mysteriously fail from cron (and just hang around not
  doing much of anything) I found that using absolute
  paths to *everything* solved most of those problems.

* I set the expect log_user variable to 0 so that I do
  not get any mail about the process.

* I used: set env(SHELL) /bin/sh
  because I was having trouble with figuring out which
  shell was going to run, and this seemed easiest.

I am using the same system to run a daily report too.

I had never used cron, and it was tough to get this
working, but now it seems pretty good.




view thread (12+ messages)  latest in thread

Message-ID: <aipmap$1afd$2@news.hub.org>
Permalink:  ../aipmap$1afd$2@news.hub.org/
Also on:    postgresql.org/message-id/aipmap$1afd$2@news.hub.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: missive@frontiernet.net
  Subject: Re: Automated database backups and authentication
  In-Reply-To: <aipmap$1afd$2@news.hub.org>
  References: <20020806181501.58BFD475835@postgresql.org> <aipmap$1afd$2@news.hub.org>

* 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