X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver.stop;h=b117826b29f260096326d10d45acad521aebb858;hb=d45518897217889e8571d94d4459ee12c4db56a0;hp=8ebdf9019d5858779a47e39312b17ed00f512e67;hpb=996982ec36d2db18489dce2a00951fbece220bb7;p=util-vserver.git diff --git a/util-vserver/scripts/vserver.stop b/util-vserver/scripts/vserver.stop index 8ebdf90..b117826 100644 --- a/util-vserver/scripts/vserver.stop +++ b/util-vserver/scripts/vserver.stop @@ -17,8 +17,9 @@ if ! isVserverRunning "$VSERVER_DIR" S_CONTEXT; then echo $"vserver '$VSERVER_NAME' is not running; aborting..." >&2 - umountVserver "$VSERVER_DIR" &>/dev/null || : - disableInterfaces "$VSERVER_DIR" &>/dev/null || : + test "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null + umountVserver "$VSERVER_DIR" || : + disableInterfaces "$VSERVER_DIR" || : exit 1 fi @@ -31,7 +32,12 @@ execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-stop cd "$VSERVER_DIR"/vdir/ -if $_VSERVER_INFO - FEATURE migrate; then +if test "$_IS_FAKEINIT" && \ + $_VSERVER_INFO - FEATURE vkill && \ + initpid=$($_VSERVER_INFO "$S_CONTEXT" INITPID 2>/dev/null); then + $_VKILL -s INT -- "$initpid" && "${INITCMD_STOP_SYNC[@]}" || : +elif $_VSERVER_INFO - FEATURE migrate; then + "${NICE_CMD[@]}" \ ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" -- } \ $_VCONTEXT $SILENT_OPT --migrate --chroot --xid "$S_CONTEXT" -- \ "${INITCMD_STOP[@]}" && "${INITCMD_STOP_SYNC[@]}" || : @@ -47,6 +53,10 @@ fi sendKillSequence "$S_CONTEXT" "${INITKILL_SEQ[@]}" +## Small hack... isVserverRunning removes stale runfiles as a sideeffect +! isVserverRunning "$VSERVER_DIR" || \ + echo $"Vserver '$VSERVER_DIR' still running unexpectedly; please investigate it manually..." >&2 + execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" post-stop umountVserver "$VSERVER_DIR" || :