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

Re: dump & create with a cron job

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jack Miller <jgm(at)miller-group(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: dump & create with a cron job
Date: 2005-03-22 19:17:39
Message-ID: 11104.1111519059@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Jack Miller <jgm(at)miller-group(dot)net> writes:
> 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.

Evidently you are neglecting to check for failure of the dropdb step.
Perhaps something like

	while ! dropdb active_demo; do
		sleep 10
	done
	createdb active_demo
	/usr/bin/psql active_demo < demo_model.sql > /dev/null

This kinda begs the whole question of interlocking though; won't people
see funny behavior when you do this?

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Keith WorthingtonDate: 2005-03-22 19:37:24
Subject: Re: dump & create with a cron job
Previous:From: Tom LaneDate: 2005-03-22 18:53:59
Subject: Re: timestamp group by bug???

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