Doing incremental backups with rsync

The guys over at slicehost turned me on to a technique for using rsync for backups.

Here is a typical script that I now use, it works far better than things like Filezilla and Transmit because it’s very fast doesn’t require manual intervention, can be run from a crontab, and it’s free.

The script below clones everything in the remote folder /home/myname to the local folder /backups/localfolder
Read the article above for more details.

#!/bin/tcsh -fx                                                                                                                               

set exclude = "/tmp/exclude.$$"
cat <$exclude

echo "Starting $* at `date`"
rsync -e 'ssh -p 12345' -avl --delete --stats --exclude-from $exclude --progress nick@123.345.78.999:/home/myname /backups/localfolder
echo "Completed $* at `date`"

rm -f $exclude