#!/bin/bash SUFIX=`date +%Y%m%d` DIR_BASE=/tmp/`hostname`_svn_ DIR_WRK=$DIR_BASE$SUFIX DIR_REPOS=/path/to/a/directory/with/svn/repositories REPOS="SVNRepo1 SVNRepo2" STORAGE=backup@int.storage.server:/path/to/backup/location # -- init working directory echo "`date` - Preparing backup directory" rm -rf $DIR_BASE* mkdir -p $DIR_WRK echo "`date` - Changing into backup directory '$DIR_WRK'" cd $DIR_WRK for repo in $REPOS do path=$DIR_REPOS$repo if [ -d $path ]; then mkdir $repo echo "`date` - Backing up '$repo' to '$repo/repository.dump'" svnadmin dump $path > $repo/repository.dump cp $path/access-policy $repo/. cp $path/svn-auth-file $repo/. echo "`date` - Compressing '$repo' to '$repo.tgz'" tar -czf $repo.tgz $repo echo "`date` - Deleting '$repo'" rm -rf $repo else echo "`date` - Repository '$path' does not exist" continue fi done # -- transfer to a safe place echo "`date` - Transfering backup directory to a remote location" rsync -re ssh $DIR_WRK $STORAGE echo "`date` - Cleaning up backup directory" rm -rf $DIR_WRK echo "`date` - Done"
Aug 27, 2010
SVN backup script
Here something to drop to an SVN server:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment