Last active
August 29, 2015 14:16
-
-
Save panchiz/dde2b47d3479c0a6c7a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Makes a full gzipped dump of a repote SVN repository. | |
# You must have installed subversion >= 1.7. | |
set -e | |
svn_repo=$1 | |
if [ "X$svn_repo" = "X" ]; then | |
echo "You must supply the svn path" | |
exit 1 | |
fi | |
backup_dir=/opt/backups-svn | |
when=$(date +%F) | |
where=$backup_dir/$when | |
# We are not checking if it's a valid repo... | |
svn_root=$(svn info $svn_repo | grep "^Repository Root" | cut -d" " -f3) | |
svn_name=$(basename $svn_root) | |
svn_tree=$(basename $svn_repo) | |
if [ "X$svn_name" = "X$svn_tree" ]; then | |
file_name=$svn_name | |
else | |
file_name="$svn_name-$svn_tree" | |
fi | |
# Where the backup is saved | |
mkdir -p $where | |
svnrdump dump $svn_repo | gzip > $where/$file_name.dump.gzip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment