Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to set up automated backups of my svn repositories with the help of backupninja, but it seems like the paths used when running the svn-hot-backup.py script are wrong. (svn-hot-backup.py is the copy-pasted hot-backup.py from here since I could not find it included in the raspbian dist)

This is the beginning of the log file:

Apr 07 18:05:32 Debug: check_perms /etc/backup.d
Apr 07 18:05:32 Debug: perms: drwxrwx---
Apr 07 18:05:32 Debug: gperm: rwx
Apr 07 18:05:32 Debug: wperm: ---
Apr 07 18:05:32 Debug: check_perms /etc/backup.d/etherealcode.svn
Apr 07 18:05:32 Debug: perms: -rw-r-----
Apr 07 18:05:32 Debug: gperm: r--
Apr 07 18:05:32 Debug: wperm: ---
Apr 07 18:05:32 Info: >>>> starting action /etc/backup.d/etherealcode.svn (because of --now)
Apr 07 18:05:32 Debug: yes
Apr 07 18:05:32 Debug: executing handler in locked section controlled by /var/lock/backupninja/_etc_backup.d_etherealcode.svn
Apr 07 18:05:33 Debug: [Errno 2] No such file or directory
Beginning hot backup of '/mnt/data/svnrepos/./etherealdesign'.
Apr 07 18:05:33 Error: command failed -- /usr/share/subversion/svn-hot-backup.py /mnt/data/svnrepos/./etherealdesign /var/backups/svn.tmp/./etherealdesign

This is my /etc/backup.d/action.svn file:

##
## Perform a hot backup of subversion repositories.
##
## REQUIRES: apt-get install subversion-tools
##
## This file can be empty, the defaults are usually good.
##

when = sunday at 02:00

## where subversion data lives
src = /mnt/data/svnrepos

## where to save the backups to
dest = /mnt/backup/data/svnrepos

## where to save temporary backups
## (if successful, $tmp is moved to $dest)
#tmp = /tmp/svn.tmp

## the hotbackup program to use.
HOTBACKUP = /usr/share/subversion/svn-hot-backup.py

## the name of the vserver containing svn, if using vservers
# vsname =

As you can see there is an extra ./ in the path to the repository. Is this a known bug or is something wrong in my configuration files?

I managed to find this script here /usr/share/backupninja/svn, but I have no idea if this it what creates the faulty paths:

# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
#
# this handler will backup subversion repostitories.
#

getconf src /var/lib/svn
getconf dest /var/backups/svn
getconf tmp /var/backups/svn.tmp
getconf HOTBACKUP "/usr/bin/svnadmin hotcopy"
getconf vsname

error=0

# Decide if the handler should operate on a vserver or on the host.
# In the former case, check that $vsname exists and is running.
usevserver=no
vroot=''
if [ $vservers_are_available = yes ]; then
   if [ -n "$vsname" ]; then
      # does it exist ?
      if ! vservers_exist "$vsname" ; then
         fatal "The vserver given in vsname ($vsname) does not exist."
      fi
      # is it running ?
      vservers_running $vsname || fatal "The vserver $vsname is not running."
      # everything ok
      info "Using vserver '$vsname'."
      usevserver=yes
      vroot="$VROOTDIR/$vsname"
   else
      info "No vserver name specified, actions will be performed on the host."
   fi
fi

cd $vroot$src
for repo in `find . -name svnserve.conf`
do
   repo=`dirname $repo`
   repo=`dirname $repo`

   ret=`mkdir -p $vroot$tmp/$repo 2>&1`
   code=$?
   if [ "$ret" ]; then
      debug "$ret"
   fi
   if [ $code != 0 ]; then
      error "command failed mkdir -p $vroot$tmp/$repo"
   fi

   if [ $usevserver = yes ]
   then
      ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
   else
      ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
   fi
   code=$?
   if [ "$ret" ]; then
      debug "$ret"
   fi
   if [ $code != 0 ]; then
      error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo"
      error=1
   fi
done

if [ $error -eq 1 ]; then
   echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest"
else
   if [ -d $vroot$dest -a -d $vroot$tmp ]; then
      rm -rf $vroot$dest
   fi
   if [ -d $vroot$tmp ]; then
      mv $vroot$tmp $vroot$dest
   fi
fi

exit 0
share|improve this question

1 Answer 1

up vote 0 down vote accepted

To fix it I added

repo='basename $repo'

right below the lines:

repo='dirname $repo'
repo='dirname $repo'

in /usr/share/backupninja/svn

I have also added a bug report to the official site

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.