With all the websites that I run, keeping backups is essentail.
I first wrote a bash script that I ran on a cron job whcih backed up each database and then zipped the sql file up:
#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql
cd /sqldata/
tar -zcvf sqldata.tgz *.sql
This meant that I had to modify this backup script each time I added a database. I then found that you can use the ‘–all-databases’ option to backup all the databases at once:
#!/bin/sh–all-databases
mysqldump -uroot -ppwd > /sqldata/data.sql
cd /sqldata/
tar -zcvf sqldata.tgz *.sql
This works perfectly.
After creating the Tar file I store it on the server where a secondary script runs copying thes backups off site and deleting fiels older than 21 days, meanind that I have a rolling 3 week backup both on the server and off the server.
Related posts:
- How To Check If You Are Ready For WordPress 3.2 If you have ready my previous post about a first view of WordPress 3.2, you will have noted that there are some significant requirements changes...






