SVN dump
From wiki.welmers.net
Comparable to MySQL_dump
#!/bin/sh
#
# SVN dump script
# (C) 2011 Bastiaan Welmers
#
# http://wiki.welmers.net/en/SVN_dump
#
# !!!!!!!!!! CONFIGURE THIS VARIABLES TO YOUR LOCAL NEEDS !!!!!!!!!!
REPOSDIR=/home/svn/repos
# make shure this directory exists
DUMPDIR=/var/tmp/svndump
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TODAY=`date +%Y_%m_%d`
mkdir $DUMPDIR/$TODAY
if [ ! -d $DUMPDIR/$TODAY ]; then
echo "Error: cannot create directory $DUMPDIR/$TODAY"
exit
fi
case `uname` in
NetBSD | OpenBSD | FreeBSD )
WEEKAGO=`date -r $((\`date "+%s"\` - 604800)) +%Y_%m_%d`
;;
Linux )
WEEKAGO=`date -d "1 weeks ago" +%Y_%m_%d`
;;
*)
echo "Error: system 'uname' does not return either NetBSD, OpenBSD, FreeBSD or Linux. Please check the /bin/date of your system before using this script and adapt this script $0 if necessary"
exit
;;
esac
for repository in `ls $REPOSDIR`; do
svnadmin dump $REPOSDIR/$repository | gzip > $DUMPDIR/$TODAY/$repository.dump.gz
done;
if [ -n "$WEEKAGO" ]; then
rm -rf $DUMPDIR/$WEEKAGO
fi