Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 script are wrong. ( is the copy-pasted 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/ /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/

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


# Decide if the handler should operate on a vserver or on the host.
# In the former case, check that $vsname exists and is running.
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."
      # is it running ?
      vservers_running $vsname || fatal "The vserver $vsname is not running."
      # everything ok
      info "Using vserver '$vsname'."
      info "No vserver name specified, actions will be performed on the host."

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

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

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

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

exit 0
share|improve this question
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .