From cf1817d075b934aeab77d7bf10da3bf886b034ae Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Sat, 27 Aug 2005 00:19:50 +0000
Subject: [PATCH] mysql and dup handlers: when using a vserver, check if it is
 running

---
 changelog      | 2 ++
 handlers/mysql | 7 ++++++-
 handlers/pgsql | 1 +
 handlers/svn   | 7 ++++++-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/changelog b/changelog
index 2dae7ad5..8e056cfb 100644
--- a/changelog
+++ b/changelog
@@ -27,6 +27,8 @@ version 0.8 --
           then nano, vim and vi, and aborts if none of these exists.
     added helper for pgsql handler.
     rdiff handler now does not require 'label'
+    changes to mysql and svn handlers' vservers support
+        these handlers now check if the source vserver is running
 
 version 0.7 -- July 26 2005
 	added ninjahelper: a dialog based wizard for creating backupninja configs.
diff --git a/handlers/mysql b/handlers/mysql
index d5c0370e..e5306db4 100644
--- a/handlers/mysql
+++ b/handlers/mysql
@@ -39,11 +39,16 @@ then
 	fi
 fi
 
-# Check to make sure that the specified vserver exists
+# If needed, make sure that the specified vserver exists and is running.
 if [ $usevserver ]
 then
+        info "examining vserver '$vsname'"
+        # does it exist ?
 	vroot="$VROOTDIR/$vsname"
 	[ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'"
+        # is it running ?
+        running=`$VSERVERINFO $vsname RUNNING`
+        [ $running = 1 ] || fatal "vserver $vsname is not running."
 fi
 	
 # create backup dirs, the vroot variable will be empty if no vsname was specified
diff --git a/handlers/pgsql b/handlers/pgsql
index 11a5cfef..9b1d8b7f 100644
--- a/handlers/pgsql
+++ b/handlers/pgsql
@@ -1,3 +1,4 @@
+#! /bin/sh
 #
 # PostgreSQL handler script for backupninja
 #
diff --git a/handlers/svn b/handlers/svn
index 551255b9..6ac54029 100644
--- a/handlers/svn
+++ b/handlers/svn
@@ -23,11 +23,16 @@ then
 	fi
 fi
 
-# Check to make sure that the specified vserver exists
+# If needed, make sure that the specified vserver exists and is running.
 if [ $usevserver ]
 then
+	info "examining vserver '$vsname'"
+        # does it exist ?
 	vroot="$VROOTDIR/$vsname"
 	[ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'"
+        # is it running ?
+	running=`$VSERVERINFO $vsname RUNNING`
+	[ $running = 1 ] || fatal "vserver $vsname is not running."
 fi
 
 cd $vroot$src
-- 
GitLab