Re: dump & create with a cron job - Mailing list pgsql-novice

From Tom Lane
Subject Re: dump & create with a cron job
Date
Msg-id 11104.1111519059@sss.pgh.pa.us
Whole thread Raw
In response to dump & create with a cron job  (Jack Miller <jgm@miller-group.net>)
Responses Re: dump & create with a cron job
List pgsql-novice
Jack Miller <jgm@miller-group.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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: timestamp group by bug???
Next
From: "Keith Worthington"
Date:
Subject: Re: dump & create with a cron job