Re: how to detect the backup database every day - Mailing list pgsql-general

From Richard Huxton
Subject Re: how to detect the backup database every day
Date
Msg-id 46B86557.50901@archonet.com
Whole thread Raw
In response to how to detect the backup database every day  (son@raider.co.nz)
Responses Re: how to detect the backup database every day  (brian <brian@zijn-digital.com>)
List pgsql-general
son@raider.co.nz wrote:
> Hello all
>
> I use a crontab job to backup and restore my database every midnight every
> day (using pg_dump and restore...)
>
> My cron job run well for a while. However, today I discovered that my
> database was not restored for one month.
>
> I also fix the problem as there is corruption in the script.
>
> My question is how I can detect whether the backup or restore processes is
> corrupted. I donot want that my backup database is one month old  -:(

Well, if the script failed with an error, cron should have sent you an
email (or the user the script runs as, anyway).

If you didn't have an error, you could run a separate cron that checks
whether there are recent backup files and emails you if not (find ...
-mtime -1).

Or, if you want to make sure the restore has worked check the database
for a row with a recent timestamp.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Geoffrey
Date:
Subject: Re: backend process terminates
Next
From: "Rajaram J"
Date:
Subject: Having trouble building 64-bit pgsql 7.4.17 on HPUX ia64