Created
November 17, 2009 04:23
-
-
Save tjstein/236639 to your computer and use it in GitHub Desktop.
gs-backup.sh
This file contains 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/bash | |
# Tar shit up: | |
today=$(date '+%d_%m_%y') | |
echo "* Performing domain backup..." | |
tar czf /var/backups/constantshift.com_"$today".tar.gz -C / var/www/constantshift.com | |
echo "* Backed up..." | |
# Remove shit older than 7 days: | |
MaxFileAge=7 | |
find /var/backups/ -name '*.gz' -type f -mtime +$MaxFileAge -exec rm -f {} \; | |
# Rsync shit to the grid: | |
echo "* Rsyncing to remote host..." | |
rsync --quiet -az -e "ssh -i /root/.ssh/id_rsa" "/var/backups/constantshift.com_"$today".tar.gz" s58608.gridserver.com@s58608.gridserver.com:/home/58608/data/backup/ | |
echo "* Rsync finished!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment