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