diff options
Diffstat (limited to 'handlers')
-rw-r--r-- | handlers/mysql | 2 | ||||
-rw-r--r-- | handlers/rdiff | 2 | ||||
-rw-r--r-- | handlers/svn | 2 | ||||
-rwxr-xr-x | handlers/sys | 2 | ||||
-rw-r--r-- | handlers/trac | 51 |
5 files changed, 55 insertions, 4 deletions
diff --git a/handlers/mysql b/handlers/mysql index a4a1497..d5c0370 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -28,7 +28,7 @@ fi # If vservers are configured, decide if the handler should # use them or if it should just operate on the host -if [ "$VSERVERS" = "yes" ] +if [ "$vservers" = "yes" ] then if [ ! -z $vsname ] then diff --git a/handlers/rdiff b/handlers/rdiff index ca97fa4..713f4c6 100644 --- a/handlers/rdiff +++ b/handlers/rdiff @@ -26,7 +26,7 @@ getconf user; destuser=$user getconf host; desthost=$host # See if vservers are configured -if [ "$VSERVERS" = "yes" ] +if [ "$vservers" = "yes" ] then if [ ! -d $VROOTDIR ] then diff --git a/handlers/svn b/handlers/svn index cd3cc2e..551255b 100644 --- a/handlers/svn +++ b/handlers/svn @@ -12,7 +12,7 @@ error=0 # If vservers are configured, decide if the handler should # use them or if it should just operate on the host -if [ "$VSERVERS" = "yes" ] +if [ "$vservers" = "yes" ] then if [ ! -z $vsname ] then diff --git a/handlers/sys b/handlers/sys index f111097..9b836a7 100755 --- a/handlers/sys +++ b/handlers/sys @@ -27,7 +27,7 @@ getconf hardware yes getconf hardwarefile /var/backups/hardware.txt # See if vservers are configured -if [ "$VSERVERS" = "yes" ] +if [ "$vservers" = "yes" ] then if [ ! -d $VROOTDIR ] then diff --git a/handlers/trac b/handlers/trac new file mode 100644 index 0000000..d344082 --- /dev/null +++ b/handlers/trac @@ -0,0 +1,51 @@ +# +# this handler will backup trac environments (based on the svn handler) +# +# http://trac.edgewall.com/ +# + +getconf src /var/lib/trac +getconf dest /var/backups/trac +getconf tmp /var/backups/trac.tmp + +error=0 +cd $src +for repo in `find . -name VERSION` +do + repo=`dirname $repo` + + # Just make the $tmp dir, not $tmp/$repo + ret=`mkdir -p $tmp 2>&1` + code=$? + if [ "$ret" ]; then + debug "$ret" + fi + if [ $code != 0 ]; then + error "command failed mkdir -p $tmp" + fi + + ret=`trac-admin $src/$repo hotcopy $tmp/$repo 2>&1` + code=$? + if [ "$ret" ]; then + debug "$ret" + fi + if [ $code != 0 ]; then + error "command failed -- trac-admin $src/$repo hotcopy $tmp/$repo" + error=1 + fi +done + +if [ $error -eq 1 ]; then + echo "Error: because of earlier errors, we are leaving trac backups in $tmp instead of $dest" +else + if [ -d $dest -a -d $tmp ]; then + rm -rf $dest + fi + if [ -d $tmp ]; then + mv $tmp $dest + fi +fi + +exit 0 + +# vim: filetype=sh |