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

Re: making (incremental) backups of a repository

From: Scott Lawrence <slawrence_at_pingtel.com>
Date: 2004-03-24 22:43:23 CET

On Fri, 2004-03-19 at 04:32, Dirk Dierckx wrote:
> Hi,
>
> I would like to make a full backup every sunday night and an incremental each
> day afterwards until the next sunday. But how do i retrieve the last revision
> stored in the full/prev. incremental backup?

I store it separately. Here's my subversion.daily script. It runs as
the repository owner from crontab - each project has its own repository
under /scm/rep/ and backups go in a parallel directory under /scm/bak/:

=====================================
#!/bin/sh
###
### Do daily incremental backups of all subversion projects
###
 
Start=`date +%s`
 
umask 022
 
cd /scm/rep || exit 1;
 
for Proj in *
do
  if [ -d ${Proj} ] && [ -f ${Proj}/format ]
  then
    BAK=/scm/bak/${Proj}
    INCR=${BAK}/INCR.latest
    if [ -s ${INCR} ]
    then
        LAST=`cat ${INCR}`
    else
        LAST=0
    fi
    HEAD=`svnlook youngest ${Proj}`
 
    if [ ${LAST} -lt ${HEAD} ]
    then
        RANGE="${LAST}:${HEAD}"
        if [ ${LAST} -ne 0 ]
        then
            type=--incremental
        else
            type=
        fi
 
        if svnadmin dump --quiet ${type} -r ${RANGE} \
               ${Proj} > ${BAK}/${Proj}.incr.${RANGE}
        then
            echo ${HEAD} > ${INCR}
        else
            echo "Subversion incremental backup failed. ${RANGE}" 1>&2
        fi
    fi
  else
    echo "Not a subversion repository: /scm/rep/${Proj}" 1>&2
  fi
done
 
Stop=`date +%s`
 
Seconds=`echo ${Stop} ${Start} - p | dc`
 
echo "Subversion Incremental Backups completed in ${Seconds} seconds"
=============================

-- 
Scott Lawrence        
  Pingtel Corp.   
  sip:slawrence {at} pingtel.com  
  +1.781.938.5306 x162
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Mar 24 22:44:27 2004

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.