1 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
3 # this handler will backup subversion repostitories.
6 getconf src /var/lib/svn
7 getconf dest /var/backups/svn
8 getconf tmp /var/backups/svn.tmp
9 getconf HOTBACKUP "/usr/bin/svnadmin hotcopy"
14 # If vservers are configured, decide if the handler should
15 # use them or if it should just operate on the host
16 if [ "$vservers" = "yes" ]
20 info "Using vserver '$vsname'"
23 info "No vserver name specified, actions will be performed on the host"
27 # If needed, make sure that the specified vserver exists and is running.
30 info "examining vserver '$vsname'"
32 vroot="$VROOTDIR/$vsname"
33 [ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'"
35 running=`$VSERVERINFO $vsname RUNNING`
36 [ "$running" = "1" ] || fatal "vserver $vsname is not running."
40 for repo in `find . -name svnserve.conf`
45 ret=`mkdir -p $vroot$tmp/$repo 2>&1`
50 if [ $code != 0 ]; then
51 error "command failed mkdir -p $vroot$tmp/$repo"
56 ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
58 ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
64 if [ $code != 0 ]; then
65 error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo"
70 if [ $error -eq 1 ]; then
71 echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest"
73 if [ -d $vroot$dest -a -d $vroot$tmp ]; then
76 if [ -d $vroot$tmp ]; then
77 mv $vroot$tmp $vroot$dest