X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvshelper;h=efcf482644c1a726355234154ae68c3c20525b47;hb=c574f33e210c3438945209d685c218c51f74cbaa;hp=0bc4e105042ed79e5f77eae8ac21a189363dcaa8;hpb=bfcba376f9e666de4fa3a42aa3198a3a316d6a0a;p=util-vserver.git diff --git a/util-vserver/scripts/vshelper b/util-vserver/scripts/vshelper index 0bc4e10..efcf482 100755 --- a/util-vserver/scripts/vshelper +++ b/util-vserver/scripts/vshelper @@ -19,7 +19,7 @@ : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} test -e "$UTIL_VSERVER_VARS" || { - echo "Can not find util-vserver installation; aborting..." >&2 + echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 exit 1 } . "$UTIL_VSERVER_VARS" @@ -54,11 +54,11 @@ function doInternalMethod case "$ACTION" in (restart) logging $"Restarting vserver '$VSERVER'" - execute $_VSERVER "$VSERVER" restart + execute $_VSERVER --defaulttty "$VSERVER" restart ;; (halt|poweroff) logging $"Stopping vserver '$VSERVER'" - execute $_VSERVER "$VSERVER" stop + execute $_VSERVER --defaulttty "$VSERVER" stop ;; (swsusp) ## TODO: any senseful action here? Perhaps shutdown scheduler for it? @@ -114,9 +114,10 @@ function doDefaultMethod #=========== if ! tty -s; then - findFile _VS_LOGFILE "$CONFDIR"/.defaults/apps/vshelper/logfile /dev/null - findFile _VS_ERRFILE "$CONFDIR"/.defaults/apps/vshelper/logfile /dev/null + findObject -e _VS_LOGFILE "$CONFDIR"/.defaults/apps/vshelper/logfile /dev/null + findObject -e _VS_ERRFILE "$CONFDIR"/.defaults/apps/vshelper/logfile /dev/null + exec >$_VS_LOGFILE exec 2>>$_VS_ERRFILE fi @@ -132,23 +133,31 @@ vshelper.isEnabled || exit 0 set -eu -declare -r XID=$1 -declare -r ACTION=$2 +if $_VSERVER_INFO - FEATURE vshelper0; then + declare -r XID=$1 + declare -r ACTION=$2 +elif $_VSERVER_INFO - FEATURE vshelper; then + declare -r ACTION=$1 + declare -r XID=$2 +else + panic $"vshelper functionality not supported by kernel" +fi this_xid=$($_VSERVER_INFO - XID) pxid= +responsible_xid=$XID while true; do - pxid=$($_VSERVER_INFO "$XID" PXID) || break - test "$pxid" -ne "$this_xid" || break - xid=$pxid + pxid=$($_VSERVER_INFO "$responsible_xid" PXID) || break + test "$pxid" -ne "$this_xid" || break + xid=$responsible_xid done -vserver_id=$($_VSERVER_INFO "$XID" ID) || - panic $"No responsible vserver found for xid '$1' ($XID); aborting..." +vserver_id=$($_VSERVER_INFO "$responsible_xid" ID) || + panic $"No responsible vserver found for resonsible xid '$responsible_xid' ($XID); aborting..." -test "$1" = "$XID" || { - logging "Giving 'vshelper' task for '$1' to parent vserver '$vserver_id' ($XID)" +test "$XID" = "$responsible_xid" || { + logging "Giving 'vshelper' task for '$XID' to parent vserver '$vserver_id' ($responsible_xid)" execute $_VSERVER "$vserver_id" exec $_VSHELPER "$@" }