Last active
August 29, 2015 13:58
-
-
Save nshopik/10134265 to your computer and use it in GitHub Desktop.
simple-backup
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 | |
cd /root/backup || exit | |
date=`date +%F` | |
days=10 | |
host=`hostname` | |
nice rsync -aR --delete --link-dest=$PWD/$host.current --exclude-from=exclude.list \ | |
/etc/apache2 \ | |
/var/www \ | |
$host.$date && \ | |
( rm -f $host.current; ln -s $host.$date $host.current ) && \ | |
find $host.* -maxdepth 0 -type d -ctime +$(( $days - 1 )) -exec rm -r {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment