aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-06-24 16:05:44 +0000
committerintrigeri <intrigeri@boum.org>2008-06-24 16:05:44 +0000
commitfd6796ad99b90371594c3068e6d8bbbdb2b1d1d5 (patch)
tree4d6491f2cc3dfaa59f5c570f6a438c35e7dcc4dd /handlers
parent88b787718d190b01101c656f805bf32f9b116137 (diff)
downloadbackupninja-fd6796ad99b90371594c3068e6d8bbbdb2b1d1d5.tar.gz
backupninja-fd6796ad99b90371594c3068e6d8bbbdb2b1d1d5.tar.bz2
sys: support selection of VServers to run on with the new vsnames configuration option (Closes: Trac#45)
Diffstat (limited to 'handlers')
-rw-r--r--handlers/sys.helper.in4
-rwxr-xr-xhandlers/sys.in17
2 files changed, 16 insertions, 5 deletions
diff --git a/handlers/sys.helper.in b/handlers/sys.helper.in
index 6451ae2..e39e526 100644
--- a/handlers/sys.helper.in
+++ b/handlers/sys.helper.in
@@ -32,6 +32,10 @@ $hardware
# packagesfile = /var/backups/dpkg-selections.txt
# partitionsfile = /var/backups/partitions.__star__.txt
# hardwarefile = /var/backups/hardware.txt
+
+# If vservers = yes in /etc/backupninja.conf then the following variables can
+# be used:
+# vsnames = all | <vserver1> <vserver2> ... (default = all)
EOF
chmod 600 $next_filename
}
diff --git a/handlers/sys.in b/handlers/sys.in
index 0f863d7..455234d 100755
--- a/handlers/sys.in
+++ b/handlers/sys.in
@@ -73,11 +73,18 @@ getconf HWINFO `which hwinfo`
getconf sfdisk_options ""
getconf hwinfo_options ""
-# See if vservers are configured
+getconf vsnames all
+
+# If vservers are configured, check that the ones listed in $vsnames are running.
local usevserver=no
-if [ $vservers_are_available = yes ]
-then
- info "vserver method enabled"
+if [ $vservers_are_available = yes ]; then
+ if [ "$vsnames" = all ]; then
+ vsnames="$found_vservers"
+ fi
+ if ! vservers_running "$vsnames" ; then
+ fatal "At least one of the vservers listed in vsnames ($vsnames) is not running."
+ fi
+ info "Using vservers '$vsnames'"
usevserver=yes
fi
@@ -91,7 +98,7 @@ if [ "$packages" == "yes" ]; then
if [ $usevserver = yes ]; then
info "vserver root directory set to: $VROOTDIR"
- for vserver in $found_vservers; do
+ for vserver in $vsnames; do
info "examining vserver: $vserver"
# is it running ?
vservers_running $vserver