Last active
December 18, 2015 13:49
-
-
Save sadbox/5792952 to your computer and use it in GitHub Desktop.
tarsnap backup script
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/bash | |
| logfile="/var/log/tarsnap.log" | |
| email="email@gmail.com" | |
| stuff_to_back_up="/home/ /etc/ /var/www/" | |
| exclude_pattern="Dropbox" | |
| ( /bin/echo "$(/bin/date +"%T %F") Starting backup" | |
| /usr/local/bin/tarsnap -c --configfile /usr/local/etc/tarsnap.conf --exclude $exclude_pattern -f "$HOSTNAME-$(/bin/date +%F)" $stuff_to_back_up 2>&1 | |
| /bin/echo "$(/bin/date +"%T %F") Backup finished" | |
| ) | /usr/bin/tee -a $logfile | /usr/bin/mailx -s "$HOSTNAME backup results" $email | |
| /bin/echo "=================================" >> /var/log/tarsnap.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment