1 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
2 # vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
4 # this handler will backup subversion repostitories.
7 getconf src /var/lib/svn
8 getconf dest /var/backups/svn
9 getconf tmp /var/backups/svn.tmp
10 getconf HOTBACKUP "/usr/bin/svnadmin hotcopy"
15 # Decide if the handler should operate on a vserver or on the host.
16 # In the former case, check that $vsname exists and is running.
19 if [ $vservers_are_available = yes ]; then
20 if [ -n "$vsname" ]; then
22 if ! vservers_exist "$vsname" ; then
23 fatal "The vserver given in vsname ($vsname) does not exist."
26 vservers_running $vsname || fatal "The vserver $vsname is not running."
28 info "Using vserver '$vsname'."
30 vroot="$VROOTDIR/$vsname"
32 info "No vserver name specified, actions will be performed on the host."
37 for repo in `find . -name svnserve.conf`
42 ret=`mkdir -p $vroot$tmp/$repo 2>&1`
47 if [ $code != 0 ]; then
48 error "command failed mkdir -p $vroot$tmp/$repo"
51 if [ $usevserver = yes ]
53 ret=`$VSERVER $vsname exec $HOTBACKUP $src/$repo $tmp/$repo 2>&1`
55 ret=`$HOTBACKUP $src/$repo $tmp/$repo 2>&1`
61 if [ $code != 0 ]; then
62 error "command failed -- $HOTBACKUP $vroot$src/$repo $vroot$tmp/$repo"
67 if [ $error -eq 1 ]; then
68 echo "Error: because of earlier errors, we are leaving svn backups in $vroot$tmp instead of $vroot$dest"
70 if [ -d $vroot$dest -a -d $vroot$tmp ]; then
73 if [ -d $vroot$tmp ]; then
74 mv $vroot$tmp $vroot$dest