我正在尝试使用 backupninja 设置我的 svn 存储库的自动备份,但运行脚本时使用的路径似乎svn-hot-backup.py
错误。(svn-hot-backup.py
是hot-backup.py
从这里因为我没有在 raspbian dist 中找到它)
这是日志文件的开头:
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
这是我的/etc/backup.d/action.svn
文件:
##
## 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 =
如您所见,./
存储库路径中有一个额外的内容。这是一个已知错误还是我的配置文件有问题?
我设法在这里找到了这个脚本/usr/share/backupninja/svn
,但我不知道这是否是造成错误路径的原因:
# -*- 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
答案1
为了修复它我添加了
repo='基本名称$repo'
就在下面几行:
repo='dirname $repo'
repo='dirname $repo'
在/usr/share/backupninja/svn
我还添加了错误报告前往官方网站