You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Andy Peters <de...@latke.net> on 2006/09/01 02:30:11 UTC
Re: => Backup ?
On Aug 31, 2006, at 8:25 AM, Anthony Muller wrote:
> Hello,
>
> What is the simple way to make a repository backup in order to do a
> full restore later (if a problem occurred)?
>
> Is "hotcopy" the best way?
here's a shell script I cooked up.
It assumes the repo is stored in /Volumes/Repodisk/svnowner/svnroot
and hotcopies it to a new directory called /Volumes/Repodisk/svnowner/
svnroot_backup/$DATE. It then tar-gzs the backup. Finally, it scps
it to another machine on the network. Works fine on Mac OS X.
You'll need to make sure your ssh-agent is running.
#!/bin/bash
BASE=/Volumes/Repodisk/svnowner
DATE=`date +%Y%m%d%H%M%S`
SVNROOT=$BASE/svnroot
SVNBKUP=$BASE/svnroot_backup/$DATE
ZIPPED=$BASE/svnroot_backup/$DATE.tar.gz
SCPDEST="svnowner@slug:~/svnroot_backups/"
echo $SCPDEST
echo "Starting svnadmin hotcopy:"
svnadmin hotcopy $SVNROOT $SVNBKUP
echo "Starting archive process:"
tar -cvzf $ZIPPED $SVNBKUP
echo "Copying archive over network:"
scp $ZIPPED $SCPDEST
echo "Done!"
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: => Backup ?
Posted by Jan Erik Moström <li...@mostrom.pp.se>.
Being a complete svn newbie and having only some personal repositories I created
a simple post-commit script that sets a flag, once each day another scripts
checks to see if the repository has changed, if so the repository is dumped to
folder. This and other folders are then backed up using dirvish.
Seem to work fine for my requirements.
jem
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: => Backup ?
Posted by Rainer Sokoll <R....@intershop.de>.
On Thu, Aug 31, 2006 at 07:30:11PM -0700, Andy Peters wrote:
> On Aug 31, 2006, at 8:25 AM, Anthony Muller wrote:
>
> >Hello,
> >
> >What is the simple way to make a repository backup in order to do a
> >full restore later (if a problem occurred)?
> >
> >Is "hotcopy" the best way?
>
>
> here's a shell script I cooked up.
Here's my solution (with dump, not hotcopy) - it is not perfect:
It reads the repos to dump from a file called "todump", This file
contains the repos in mention line-after line in the form of:
SVNROOT/repo1
SVNROOT/repo2
I have 2 scripts, one for incremental backups, one for full backups. If
the incremental script does not find a full backup, it does a full
backup.
svnbackup.incremental:
------8<----
#!/bin/sh
BACKUPDIR=/svn/backup/incremental/
SVNDIR=/usr/local/subversion-with-ssl-1.3.2/bin/
REPDIR=/svn/svn/
REP=`cat /root/bin/todump`
BZIP2="/usr/bin/bzip2 -9"
for i in ${REP} ; do
if [ ! -d ${BACKUPDIR}${i} ] ; then
mkdir -p ${BACKUPDIR}${i}
fi
CUR_REV=`${SVNDIR}svnlook youngest ${REPDIR}${i}`
LAST_FULL_BACKUP=`ls -1 ${BACKUPDIR}../full/${i}/ | sort -n | tail -1`
# If there is no full backup
if [ x${LAST_FULL_BACKUP} == x ] ; then
/root/bin/svnbackup.full ${i}
else
# actual version higher than last full backup?
if [ ${CUR_REV} -gt ${LAST_FULL_BACKUP} ] ; then
# something changed since the last incremental backup?
LAST_INCREMENTAL_BACKUP=`ls -1 ${BACKUPDIR}${i}/ | sort -n | tail -1`
if [ 0${LAST_INCREMENTAL_BACKUP} -ne 0${CUR_REV} ] ; then
${SVNDIR}svnadmin dump ${REPDIR}${i} --revision \
${LAST_FULL_BACKUP}:${CUR_REV} --incremental | ${BZIP2} > \
${BACKUPDIR}$i/${CUR_REV}
fi
fi
fi
done
------8<----
svnbackup.full:
------8<----
#!/bin/sh
TEMPDIR=/svn/temp/full/
BACKUPDIR=/svn/backup/full/
SVNDIR=/usr/local/subversion-with-ssl-1.3.2/bin/
REPDIR=/svn/svn/
REP=`cat /root/bin/todump`
BZIP2="/usr/bin/bzip2 -9"
if [ x${*} != x ] ; then
# we were called with arguments (from svnbackup.incremental)
if [ ! -d ${BACKUPDIR}${1} ] ; then
mkdir -p ${BACKUPDIR}${1}
fi
CUR_REV=`${SVNDIR}svnlook youngest ${REPDIR}${1}`
if [ ! -d ${TEMPDIR} ] ; then
mkdir -p ${TEMPDIR}
fi
cd ${BACKUPDIR}
mv * ${TEMPDIR}
${SVNDIR}svnadmin --quiet dump ${REPDIR}${1} | ${BZIP2} > \
${BACKUPDIR}${1}/${CUR_REV}
if [ $? -eq 0 ] ; then
cd ${TEMPDIR}
rm -rf *
else
cd ${TEMPDIR}
mv * ${BACKUPDIR}
fi
else
for i in ${REP} ; do
if [ ! -d ${BACKUPDIR}${i} ] ; then
mkdir -p ${BACKUPDIR}${i}
fi
if [ ! -d ${TEMPDIR}${i} ] ; then
mkdir -p ${TEMPDIR}${i}
fi
cd ${BACKUPDIR}
mv ${i}/* ${TEMPDIR}${i}
CUR_REV=`${SVNDIR}svnlook youngest ${REPDIR}${i}`
${SVNDIR}svnadmin --quiet dump ${REPDIR}${i} | ${BZIP2} > \
${BACKUPDIR}${i}/${CUR_REV}
if [ $? -eq 0 ] ; then
cd ${TEMPDIR}
rm -rf *
else
cd ${TEMPDIR}
mv * ${BACKUPDIR}
fi
done
fi
------8<----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org