From: intrigeri Date: Tue, 24 Jun 2008 15:49:06 +0000 (+0000) Subject: lib/vserver: added vservers_running function, use it in sys handler (to ease future... X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=7433a425ad7e75969f363e82dcc806223200c63b;p=matthijs%2Fupstream%2Fbackupninja.git lib/vserver: added vservers_running function, use it in sys handler (to ease future fix for Trac#45) git-svn-id: http://code.autistici.org/svn/backupninja/trunk@574 758a04ac-41e6-0310-8a23-8373a73cc35d --- diff --git a/ChangeLog b/ChangeLog index d139bf8..b7c2a77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ version 0.9.6 -- unreleased . Allow the entire backup run to be halted by an action, thanks to Matthew Palmer (Closes: #455836) . Fixed tr construct reporting a warning (Closes: #452669) + lib changes + vserver: + . added vservers_running function handler changes dup: . General cleanup @@ -15,7 +18,8 @@ version 0.9.6 -- unreleased new syntax. . Support every duplicity-supported transport with new configuration option desturl (Closes: #483712, #346040, Trac#2). - . Actually allow to backup only VServers, by relaxing $include test. + . + Actually allow to backup only VServers, by relaxing $include test. ldap: . support HDB backend just as the BDB one, and make message clearer when no supported backend is found (Closes: #476910) @@ -34,6 +38,7 @@ version 0.9.6 -- unreleased sys: . update for 2.6 kernels: use /proc/kallsyms instead of /proc/ksyms (Closes: Trac#39) + . use new vservers_running function from lib/vserver version 0.9.5 -- December 2, 2007 backupninja changes diff --git a/handlers/sys.in b/handlers/sys.in index 7b9fbb3..0f863d7 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -94,7 +94,7 @@ if [ "$packages" == "yes" ]; then for vserver in $found_vservers; do info "examining vserver: $vserver" # is it running ? - $VSERVERINFO -q $vserver RUNNING + vservers_running $vserver if [ $? -ne 0 ]; then warning "The vserver $vserver is not running." continue diff --git a/lib/vserver.in b/lib/vserver.in index f65bd4c..153a9b0 100644 --- a/lib/vserver.in +++ b/lib/vserver.in @@ -94,6 +94,20 @@ vservers_exist() { return 0 } +## +## If all the arguments are running vservers names, returns 0. +## Else, returns 1. Also returns 1 if no argument is given. +## +vservers_running() { + [ $# -ge 1 ] || return 1 + local args="$1" + local vserver + for vserver in $args ; do + $VSERVERINFO -q $vserver RUNNING || return 1 + done + return 0 +} + ## ## If the argument is the name of a vserver selected by the current helper, ## echoes 'on' and returns 0.