[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: David Weintraub <qazwart_at_gmail.com>
Date: Fri, 31 Oct 2008 11:11:33 -0400

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.

#! /bin/bash

########################################################################
# CONSTANTS
#
REPOS_BASE="/subversion/repositories"
BACKUP_DIR="/subversion/backups"
SVNADMIN_CMD="/usr/bin/svnadmin"
#
########################################################################

########################################################################
# BACKUP EACH AND EVERY REPOSITORY VIA THE "HOTCOPY" COMMAND
#
for repository in $REPOS_BASE/*
do
    reposBase=`basename $repository`
    date_string=`date "+%F"`
    backupName="$BACKUP_DIR/$date_string--$reposBase"
    [ -d "$backupName" ] && rm -rf $backupName/*
    mkdir -p "$backupName"
    "$SVNADMIN_CMD" hotcopy "$repository" "$backupName"
done
#
########################################################################

########################################################################
# DELETE BACKUPS OLDER THAN 7 DAYS OLD
#
find $BACKUP_DIR -mtime +7 -delete
#
########################################################################

--
David Weintraub
qazwart_at_gmail.com
On Thu, Oct 30, 2008 at 8:26 PM, chobo2 <mhubele_at_gmail.com> wrote:
>
> Hi
>
> I know there is svnadmin hotcopy is used to backup and I can make it backup
> one repository. But I want to backup all repositories in that directory. How
> would I go about doing this.
>
> I am using windows xp.
> --
> View this message in context: http://www.nabble.com/How-to-backup-all-Repositories-in-a-Directory--tp20258114p20258114.html
> Sent from the Subversion Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-31 16:12:00 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.