Created
March 10, 2013 12:24
-
-
Save danmilleruk/5128362 to your computer and use it in GitHub Desktop.
Best path for this being /scripts/backups/backup_web.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/sh | |
# Web backup script | |
# by Dan Miller | |
# http://www.danmiller.co.uk | |
### Begin Configuration ### | |
EMAIL="you@email.com" # Email address to send the backup report to. (sendmail must be installed) | |
WEBPATH="/data/www" # No trailing slash | |
DESPATH="/data/dropbox/Server Backups/www" # Destination path to perform the rsync | |
LOG="/scripts/backups/logs/www.log" # Log (can be located anywhere valid) | |
HOSTNAME=`/bin/hostname` | |
TYPE=WEB | |
DAY=$(date +%A) | |
### End Configuration ### | |
# Remove the existing log file | |
rm $LOG | |
echo "This is the $TYPE backup report for $HOSTNAME\n\n" >> $LOG | |
echo "======================================================\n" >> $LOG | |
rsync -arv --progress --delete --exclude '*.log' $WEBPATH/* "$DESPATH" >> $LOG | |
echo "\n======================================================\n\n" >> $LOG | |
echo "Sent using the magical powers of Deehem's Backup Script." >> $LOG | |
# Now we use sendmail to send the backup report. | |
/usr/bin/mail -s "$TYPE Backup Report ($DAY) for $HOSTNAME" "$EMAIL" < $LOG | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment