Backup!!!
Posted by bwakefield on July 20th, 2007
Backup your /home and /var/www partitions and your entire MySQL Database in one fell swoop. Put this in a bash script and run it from the directory you would like to have the two tar files and the .sql file stored. (/backups maybe?). Just make sure you do NOT have it running from any place in /home or /var/www. It will get really angry at you when it tries to add the tar file you are creating to itself!
sudo mysqldump -u root -p –all-databases > mysql-`date +‘%F-%a’`-full.sql
sudo tar -cvvzf www-`date +‘%F-%a’`-tar.gz /var/www
sudo tar -cvvzf home-`date +‘%F-%a’`-tar.gz /home
sudo tar -cvvzf www-`date +‘%F-%a’`-tar.gz /var/www
sudo tar -cvvzf home-`date +‘%F-%a’`-tar.gz /home
