Automatic backups

software development

#1

Well, I’ve never made any bash scripts before, but I saw http://wiki.dreamhost.com/index.php/Automatic_Backup, and it seemed a bit funny. I didn’t think all of the steps seemed entirely logical. I played around with it and this is how my file ended up (my goal being to keep copies of the file and db in a folder that is already made until I manually delete them). Any of the more experienced people out there have any thoughts/opinions?

#!/bin/bash
suffix=$(date +%y%m%d)
tar -c /home/USERNAME/.snapshot/nightly.0/DOMAIN.com/ | gzip -c > archives/DOMAIN-$suffix.tar.gz
mysqldump --opt --user=“DBUSERNAME” --password=“DBPASSWORD” -h mysql.DOMAIN.com DBNAME | gzip -c > archives/DOMAINdb-$suffix.sql.gz

Check out Gordaen’s Knowledge, the blog, and the MR2 page.