Created
April 26, 2010 07:16
-
-
Save daz/379066 to your computer and use it in GitHub Desktop.
My Ubuntu web server rsync backup scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
user="mysqluser" | |
pass="mysqlpass" | |
dir="/tmp/backup" | |
for i in /var/lib/mysql/*/; do | |
dbname=`basename $i` | |
if [ $dbname != "mysql" ]; then | |
mysqldump -u$user -p$pass $dbname > $dir/db/$dbname.sql | |
fi | |
done | |
rsync -a --delete /etc/apache2/sites-available $dir | |
rsync -a --delete --exclude-from '/tmp/backup/exclude.txt' /srv $dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/srv/www/*/logs/* | |
/srv/www/*/log/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
host="[email protected]" | |
sourcedir="/tmp/backup" | |
destdir="/backups" | |
rsync -avz --delete --progress $host:$sourcedir $destdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment