X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvsomething;h=a87c1b77d5aa289393e543d10a1d52a1b30b7ba8;hb=5b4184f854cb12f32149608868295e847191ef4a;hp=cd3c9722d2b2381786ab3f17add81e81d784322a;hpb=be9c6aed872e34b625817e77e24c8897e5f7085c;p=util-vserver.git diff --git a/scripts/vsomething b/scripts/vsomething index cd3c972..a87c1b7 100755 --- a/scripts/vsomething +++ b/scripts/vsomething @@ -29,7 +29,14 @@ test -e "$UTIL_VSERVER_VARS" || { function showHelp() { echo \ -$"Usage: $0 [--quiet|-q] [--debug] [--] * [--all] -- + +$"Usage: $0 [--quiet|-q] [--debug] [--] * [] -- + +where is any combination of: +--all All guests +--running All running guests +--stopped All stopped guests +--marked All guests with a mark set +--unmarked All guests without a mark set +--mark All guests with mark set Execute * foreach vserver. @@ -75,17 +82,24 @@ cmd=$1 title=${VSOMETHING_TITLE:-$cmd} shift -while test "$#" -ge 1; do - if getAllVserversByArg tmp "$1"; then - vservers=( "${vservers[@]}" "${tmp[@]}" ) - else +test "$1" != "--" || \ + shift + +if getAllVserversByArg tmp "$@"; then + vservers=( "${vservers[@]}" "${tmp[@]}" ) + while test "$#" -ge 1 -a "$1" != "--"; do + shift + done + shift +else + while test "$#" -ge 1; do case "$1" in (--) shift; break;; (*) vservers=( "${vservers[@]}" "$1" ) esac - fi - shift -done + shift + done +fi test "${#vservers[@]}" -ne 1 || is_quiet=1 @@ -106,12 +120,13 @@ for i in "${vservers[@]}"; do if pkgmgmt.isInternal "$i"; then $_VSERVER "$i" exec "$cmd" "$@" else - _getVserverDir "$i" + _setVserverDir "$i" + # subshell so we don't have to clean up ( _generateChbindOptions "$VSERVER_DIR" - $_VSERVER "$i" status &> /dev/null && \ - CHBIND_CMD=( "$_CHBIND" "${CHBIND_OPTS[@]}" -- ) + $_VSERVER "$i" status &> /dev/null || \ + CHBIND_CMD=() callInNamespace "$i" \ - "$_VNAMESPACE" --new -- \ + $_VNAMESPACE --new -- \ "${CHBIND_CMD[@]}" \ "$VSOMETHING_WORKER" "$i" "$@" ) fi