X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=lib%2Fvserver.in;h=153a9b0241929c661888a4c20fc3b2654ddf1755;hp=8ac7b7e5fa76b18f300c683b271ddbf9d211998e;hb=6c628e78f4f64680b5cec6b8062fe7e0f654043b;hpb=0e353b42dba44211f42108c29f3f9169aecf4e54 diff --git a/lib/vserver.in b/lib/vserver.in index 8ac7b7e..153a9b0 100644 --- a/lib/vserver.in +++ b/lib/vserver.in @@ -33,7 +33,7 @@ init_vservers() { getconf vservers no getconf VSERVERINFO /usr/sbin/vserver-info getconf VSERVER /usr/sbin/vserver - getconf VROOTDIR `if [ -x "$VSERVERINFO" ]; then $VSERVERINFO info SYSINFO | grep '^ *vserver-Rootdir' | awk '{print $2}'; fi` + getconf VROOTDIR `if [ -x "$VSERVERINFO" ]; then $VSERVERINFO info SYSINFO | grep '^ *vserver-Rootdir' | @AWK@ '{print $2}'; fi` # canonicalize VROOTDIR [ -z "$VROOTDIR" ] || VROOTDIR=`readlink --canonicalize $VROOTDIR` # init this library's global variables @@ -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.