Skip to content

Instantly share code, notes, and snippets.

@tuxpeople
Created March 6, 2012 08:13
Show Gist options
  • Save tuxpeople/1984866 to your computer and use it in GitHub Desktop.
Save tuxpeople/1984866 to your computer and use it in GitHub Desktop.
Dumps all SVN-Repos from a given location gzip compressed to a folder
#!/bin/bash
#
# svnbackup.sh
# Dumps all SVN-Repos from a given location gzip compressed to a folder
#
# Copyright (C) 2008 by Thomas Deutsch <[email protected]>
#
# License: WTFPL - Do What The Fuck You Want To Public License
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
# Variables. NO TRAILING SLASHES:
#
REPODIR="/export/dat/subversion" # Where are the repositories on the filesystem?
TARGETDIR="/export2/dat/svn_dump" # Where should the dump be stored on the filesystem?
# Step 1: Delete old dumps
#
echo "Deleting old dumps from ${TARGETDIR}..."
rm -rf ${TARGETDIR}/svn_dump_*
echo "finished..."
# Step 2: Create new dumps
#
echo "Now starting with dumps to ${TARGETDIR}..."
for TARGET in $(ls ${REPODIR})
do
echo "Dumping ${TARGET} to ${TARGETDIR}..."
svnadmin dump ${REPODIR}/${TARGET} | gzip -c > ${TARGETDIR}/svn_dump_${TARGET}_$(date +%Y%m%d).dump.gz
echo "Dumping ${TARGET} finished..."
done
echo "All Tasks done. If you haven't seen an error, everything is fine."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment