2 # this handler will backup subversion repostitories.
5 getconf src /var/lib/svn
6 getconf dest /var/backups/svn
7 getconf tmp /var/backups/svn.tmp
8 getconf HOTBACKUP "/usr/bin/svnadmin hotcopy"
13 # If vservers are configured, decide if the handler should
14 # use them or if it should just operate on the host
15 if [ "$vservers" = "yes" ]
19 info "Using vserver '$vsname'"
22 info "No vserver name specified, actions will be performed on the host"
26 # If needed, make sure that the specified vserver exists and is running.
29 info "examining vserver '$vsname'"
31 vroot="$VROOTDIR/$vsname"
32 [ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'"
34 running=`$VSERVERINFO $vsname RUNNING`
35 [ $running = 1 ] || fatal "vserver $vsname is not running."
39 for repo in `find . -name svnserve.conf`
44 ret=`mkdir -p $vroot$tmp/$repo 2>&1`
49 if [ $code != 0 ]; then
50 error "command failed mkdir -p $vroot$tmp/$repo"
55 ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
57 ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
63 if [ $code != 0 ]; then
64 error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo"
69 if [ $error -eq 1 ]; then
70 echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest"
72 if [ -d $vroot$dest -a -d $vroot$tmp ]; then
75 if [ -d $vroot$tmp ]; then
76 mv $vroot$tmp $vroot$dest