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 # Decide if the handler should operate on a vserver or on the host.
15 # In the former case, check that $vsname exists and is running.
18 if [ $vservers_are_available = yes ]; then
19 if [ -n "$vsname" ]; then
21 if ! vservers_exist "$vsname" ; then
22 fatal "The vserver given in vsname ($vsname) does not exist."
25 vservers_running $vsname || fatal "The vserver $vsname is not running."
27 info "Using vserver '$vsname'."
29 vroot="$VROOTDIR/$vsname"
31 info "No vserver name specified, actions will be performed on the host."
36 for repo in `find . -name svnserve.conf`
41 ret=`mkdir -p $vroot$tmp/$repo 2>&1`
46 if [ $code != 0 ]; then
47 error "command failed mkdir -p $vroot$tmp/$repo"
50 if [ $usevserver = yes ]
52 ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
54 ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
60 if [ $code != 0 ]; then
61 error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo"
66 if [ $error -eq 1 ]; then
67 echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest"
69 if [ -d $vroot$dest -a -d $vroot$tmp ]; then
72 if [ -d $vroot$tmp ]; then
73 mv $vroot$tmp $vroot$dest