Backup of subversion repository

This script does an svn hotcopy of a subversion repository and then rsyncs it to an external location. Easy to script, nice trouble-free way of maintaining subversion backups.

#!/bin/bash
export RSYNC_RSH=/usr/bin/ssh

# some variables in case they change later
server=destination.com # where we are sending the backup to
user=miguel
tempcopy=/home/${user}/svnbackup
dest=/media/disk/svnserver/svnbackup

# example svn repository
# make the backup with svnadmin hotcopy
svnadmin hotcopy /data1/svn/repo/ ${tempcopy}/repo/

# rsync it to the external hard drive on my desk
rsync -aHPvz ${tempcopy}/repo/ "${user}@${server}:${dest}/repo/"

# finally, remove the backup on svnserver to free up some space
rm -rf ${tempcopy}/repo