AUTOMATICALLY BACKING UP MULTIPLE SUBVERSION REPOSITORIES

Ref. to http://darcynorman.net/2006/04/05/automatically-backing-up-multiple-subversion-repositories/

I’ve just put together a dead simple script to automatically dump all of them to a directory of my choosing. I’ve added this script to the crontab for the root user on the server, and it runs svndump on all repositories, gzipping the output for archive (and possibly restore).

The output is stored in a specified backup directory, which is then picked up via rsync from my backup desktop, and copied to the external backup drive.

Create a  crontab daily job:

#vi /etc/cron.daily/dumpsvnrepo

#!/bin/bash

SVN_REPOSITORIES_ROOT_DIR=”/srv/repos/svn/”
BACKUP_DIRECTORY=”/var/backup/repos/svn/”

ls -1 $SVN_REPOSITORIES_ROOT_DIR > /tmp/bkreposlist
for REPOSITORY in `cat /tmp/bkreposlist` ;
do
echo ‘dumping repository: ‘ $REPOSITORY
svnadmin dump $SVN_REPOSITORIES_ROOT_DIR$REPOSITORY | gzip > $BACKUP_DIRECTORY$REPOSITORY’.gz’
done