Home > Articles > Ubuntu > Backup SVN

In Brief: Backup of repository to remote site via FTP

10 sep 2006, Simon Strandgaard

subversion server is Ubuntu linux

prompt> uname -a
Linux 2.6.15-26-server #1 SMP Thu Aug 3 04:09:15 UTC 2006 i686 GNU/Linux

STEP1: ensure backup scripts points to ruby and rake

prompt> which ruby
/usr/bin/ruby
prompt> which rake
/usr/bin/rake

check with the top-most line in the rakefile and in the runrake file

STEP2: place rakefile and runrake in /home/svn/.

fetch rakefile and runrake.
the dir should look like this

prompt> sudo chown svn:svn rakefile runrake
prompt> ls -l
-rw-r--r-- 1 svn svn 4737 2006-09-10 11:03 rakefile
-rwxr-xr-x 1 svn svn  303 2006-09-10 11:03 runrake
prompt> sudo cp * ~svn/.
prompt>

STEP3: verify backup is working

prompt> sudo su svn
prompt> /home/svn/runrake
prompt> ls -l
-rw-r--r-- 1 svn  svn    126 2006-09-10 11:20 lerr
-rw-r--r-- 1 svn  svn  11532 2006-09-10 11:20 lout
-rw-r--r-- 1 root root  4737 2006-09-10 11:07 rakefile
drwxrwxr-x 7 svn  svn   4096 2006-09-10 12:06 repo
drwxr-xr-x 2 svn  svn   4096 2006-09-10 11:20 resdir
-rwxr-xr-x 1 root root   303 2006-09-10 11:07 runrake
prompt>

check that you have recieved a notification mail
check that there has been uploaded a file to the remote site.

STEP4: daily backup at 0700 in the morning

prompt> sudo su svn
prompt> export EDITOR=`which vi`
prompt> crontab -e

edit something like this

# m h  dom mon dow   command
0 7 * * * /home/svn/runrake