View Single Post
  #1 (permalink)  
Old 07-10-2009, 05:33 PM
Brook Brook is offline
Registered User
 
Join Date: Apr 2005
Posts: 81
Brook is on a distinguished road
Help with cron jobs please

I was wondering if anyone here has experience with cron jobs?

I want to set up a cron to make daily back-ups of my database, but by turning my site off first.

This is how I envisage it to work:

1: rename '.htacess' (in public_html folder for the site) to .htaccess-open
2: rename '.htaccess-closed' to .htaccess
// this closes the site down so no-one can write/access the db

3: mysqldump --opt (DB_NAME) -u (DB_USERNAME) -p(DB_PASSWORD) > /path/to/dbbackup-$(date +%m%d%Y).sql
// this backs up the database

4: wait for 3 to finish
5: rename '.htaccess' to .htaccess-closed
6: rename '.htacess-open' to .htaccess
// this opens the site back up

Is this easy enough to do? Anyone got any tips/pointers?

Thanks in advance!

Last edited by Brook; 07-10-2009 at 05:42 PM.
Reply With Quote