I need to restore a database (mysql) every 30 minutes using a cron job

I'm new to cron jobs and I need to restore a database (mysql) every 30 minutes. Is there a cron job command that can restore a database from a .sql file that's been gzipped?

Or do I need to create a php script to do this and create a cron job to call this script every thirty minutes?

Also, and this is a separate question but still related to cron jobs, I'm using a cron job to backup a different database once a day, gzip it and put it in a folder above the root. Is there a way to (automatically) delete anything older than a month? Or, at least, keep the most recent 20 backups and delete the rest?

There's not a lot of good tutorial out there on this subject other that random forum posts. Any help is appreciated.

6
задан Johnny 26 October 2010 в 20:43
поделиться