[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to backup all Repositories in a Directory?

From: Thomas Harold <thomas-news_at_nybeta.com>
Date: Sat, 10 Jan 2009 09:14:26 -0500

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.




DIRS=`find ${BASE} -name uuid | $GREP 'db/uuid$' | $SED 's:/db/uuid$::'
| $SED 's:^/var/svn/::'`

for DIR in ${DIRS}
     echo "svnadmin hotcopy ${BASE}${DIR} to ${HOTCOPY}${DIR}"

     if ! test -d ${HOTCOPY}${DIR}
         mkdir -p ${HOTCOPY}${DIR}

     $RM -r ${HOTCOPY}${DIR}
     $SVNADMIN hotcopy ${BASE}${DIR} ${HOTCOPY}${DIR}

# 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.


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-01-10 15:15:30 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.