Automatic backup all SVN repositories

Here’s a shell script I use to automatically backup all of my subversion (svn) repositories.

I use Dropbox to put my backups in - it gives you easy to manage backups in the cloud for free (Free account gives you up to 2GB of storage) and pushing all backups to any machines on which you have the Dropbox setup. It’s very simple to get it working as a linux daemon with CLI only too.

#!/bin/bash
for repos in `ls /var/opt/svn/` ; do
        RESPOS_DIR=/var/opt/svn/$repos;
        svnadmin dump -q $RESPOS_DIR | gzip > ~backup/Dropbox/backups/svn/$repos.dump.gz;
        chgrp backup $RESPOS_DIR;
done

EDIT: If you are still using SVN, and you have a choice, you must stop. SVN is just awful. I used it for 5 years, switched to GIT two years ago and honestly can’t figure out how I survived all that time. Here is a quick reference for why GIT is better than SVN (and everything else): why git is better than x

comments powered by Disqus