X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver.stop;h=8dc7512b280a8f59e7b055fc1566848fdb4eb594;hb=746a16651a2b38b02c4ebc528e73acc388eddcc2;hp=55af27d1483a044c01a1afd4d2047af5b7a42ff6;hpb=5ff988c3c71b5554a040df85c98adb80f3d2fadd;p=util-vserver.git diff --git a/util-vserver/scripts/vserver.stop b/util-vserver/scripts/vserver.stop index 55af27d..8dc7512 100644 --- a/util-vserver/scripts/vserver.stop +++ b/util-vserver/scripts/vserver.stop @@ -16,26 +16,36 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if ! isVserverRunning "$VSERVER_DIR" S_CONTEXT; then - echo $"vserver '$VSERVER_NAME' is not running; aborting..." - umountVserver "$VSERVER_DIR" &>/dev/null || : - disableInterfaces "$VSERVER_DIR" &>/dev/null || : + echo $"vserver '$VSERVER_NAME' is not running; aborting..." >&2 + test "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null + umountVserver "$VSERVER_DIR" || : + disableInterfaces "$VSERVER_DIR" || : exit 1 fi +set -e generateOptions "$VSERVER_DIR" +set +e -set -e cd "$VSERVER_DIR"/vdir/ execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-stop cd "$VSERVER_DIR"/vdir/ -"${NICE_CMD[@]}" \ + +if $_VSERVER_INFO - FEATURE migrate; then + ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT" -- } \ + $_VCONTEXT $SILENT_OPT --migrate --chroot --xid "$S_CONTEXT" -- \ + "${INITCMD_STOP[@]}" && "${INITCMD_STOP_SYNC[@]}" || : +else + "${NICE_CMD[@]}" \ "$_CHBIND" "${CHBIND_OPTS[@]}" \ "$_EXEC_ULIMIT" "$VSERVER_DIR/ulimits" \ - "$_CHCONTEXT" "${CHCONTEXT_OPTS[@]}" \ - "$_CAPCHROOT" "${CAPCHROOT_OPTS[@]}" . "${INITCMD_STOP[@]}" + ${USE_VNAMESPACE:+$_VNAMESPACE --enter "$S_CONTEXT"} \ + $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" \ + "$_CAPCHROOT" "${CAPCHROOT_OPTS[@]}" "." \ + "${INITCMD_STOP[@]}" && "${INITCMD_STOP_SYNC[@]}" || : +fi -"${INITCMD_STOP_SYNC[@]}" sendKillSequence "$S_CONTEXT" "${INITKILL_SEQ[@]}" execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" post-stop