You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Thomas Harold <th...@nybeta.com> on 2009/01/10 14:14:26 UTC
Re: How to backup all Repositories in a Directory?
David Weintraub wrote:
> Here's my shell script that does just what you want. It backs up all
> repositories in your Subversion repository directory, puts on a
> timestamp, and then deletes all repository backups older than seven
> days.
Proof that there is more then one way to skin a cat. Ours looks
similar, but doesn't include a timestamp in the destination directory
(we then use rdiff-backup to push the hotcopy folder to another location).
The downside is that you have to "rm -r" the destination folder every
night, but the script takes care of that. I ended up searching for the
"db/uuid" file instead of "format". And I'm not sure that the "db/uuid"
file appears in BDB repository directories.
-----------------------------------
#!/bin/bash
BASE="/var/svn/"
HOTCOPY="/var/svn-hotcopy/"
FIND=/usr/bin/find
GREP=/bin/grep
RM=/bin/rm
SED=/bin/sed
SVNADMIN=/usr/bin/svnadmin
DIRS=`find ${BASE} -name uuid | $GREP 'db/uuid$' | $SED 's:/db/uuid$::'
| $SED 's:^/var/svn/::'`
for DIR in ${DIRS}
do
echo "svnadmin hotcopy ${BASE}${DIR} to ${HOTCOPY}${DIR}"
if ! test -d ${HOTCOPY}${DIR}
then
mkdir -p ${HOTCOPY}${DIR}
fi
$RM -r ${HOTCOPY}${DIR}
$SVNADMIN hotcopy ${BASE}${DIR} ${HOTCOPY}${DIR}
done
# insert rdiff-backup line here
-----------------------------------
I'll have to add in Marko's consistency check.
Marko's use of the find command is definitely slicker then using grep &
sed, so I'll have to study that.
We used to setup the $DIRS folder manually by typing in all of the
repository names by hand. But we're getting read to break one of our
monolithic repositories into about a dozen (or more) sub-repositories.
Probably in sub-folders so that the SVN URLs don't change (which keeps
us from breaking svn:externals). So we needed something more robust
that would search the entire /var/svn tree for any and all repositories,
no matter how deeply nested.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1015131
To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].