Skip site navigation (1) Skip section navigation (2)

dump & create with a cron job

From: Jack Miller <jgm(at)miller-group(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: dump & create with a cron job
Date: 2005-03-22 18:48:10
Message-ID: 5ae737fffc48e75a41691b25bfcc1b5e@miller-group.net (view raw or flat)
Thread:
Lists: pgsql-novice
We need to "recreate" our demonstration database about every two hours, 
and we'd like to develop a cron job, calling scripts, that will 
accomplish that for us.

The problem is.... if someone is on our web demo at the time that the 
cron job goes off, it does not "dump" the database, it only "adds" the 
data to the database as the existing one.

Basically, here's what we're trying to do:
dump (pg_dump) our demo_model database to a "demo_model.sql" file

dropdb active_demo
create active_demo
/usr/bin/psql active_demo < demo_model.sql > /dev/null

Any ideas?


Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2005-03-22 18:53:59
Subject: Re: timestamp group by bug???
Previous:From: Tom LaneDate: 2005-03-22 18:19:34
Subject: Re: Compiling 8.0.1 on Ubuntu AMD_64

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group