This is the script I am using to back up my debian dedicated server to my ubuntu desktop. It uses ssh and rsync. It uses the cool rsync link-dest trick so that instead of creating multiple copies of the same file, it creates only one copy of the file with multiple hard links to it. I have my ssh keys set up so I don't need to give a password to log in via ssh.
This uses a 'pull' technique: the desktop reads the files from the server using this script.
This is not entirely efficent in that it will create a new set of backup files even if nothing changes: if you run the script ten times in a row then you will end up with ten identical sets of files. However, it backs up a web site that changes every day so running it once a day is valid.
Next job is to put selected files within the backup set into subversion. I decided against using subversion for everything, I can't see a way to automatically delete files bit I'd like to put the main sql dump into subversion.
1 #!/bin/bash 2 3 # 4 # Rotate old backups: 5 # $1 = remote directory to backup 6 # $2 = local backup directory 7 # 8 function rotate { 9 # Ripple old backups 10 rm -rf $2/Backup9 11 mv $2/Backup8 $2/Backup9 12 mv $2/Backup7 $2/Backup8 13 mv $2/Backup6 $2/Backup7 14 mv $2/Backup5 $2/Backup6 15 mv $2/Backup4 $2/Backup5 16 mv $2/Backup3 $2/Backup4 17 mv $2/Backup2 $2/Backup3 18 mv $2/Backup1 $2/Backup2 19 mv $2/latest $2/Backup1 20 21 # Copy current version to latest, creating hard links where files have not changed. 22 # 23 rsync -avz --delete --exclude=.svn --link-dest=$2/Backup1 -e ssh $1/ $2/latest/ 24 25 # 26 # Put a date stamp in the backup directory. 27 # 28 echo >`date +$2/latest/Backup-%Y-%m-%d` "Hello Peter" 29 } 30 31 rotate sshusername@ssh.server.address:/var/www/petersblog.org /home/peter/Backup/petersblog.org 32Toggle Line Numbers


you should use rdiff-backup