X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver.start;h=8c6301b02d24551ee526cd65c42b6b4f98c637b9;hb=e3be43e3ee2157a63ea175463629c2433f595854;hp=10aab162c0d073b52d1938d4bec1ab6da8b4e5e4;hpb=6484ccc67f8883dbe6351baa53a0e28b22ce0255;p=util-vserver.git diff --git a/util-vserver/scripts/vserver.start b/util-vserver/scripts/vserver.start index 10aab16..8c6301b 100644 --- a/util-vserver/scripts/vserver.start +++ b/util-vserver/scripts/vserver.start @@ -15,6 +15,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +lock "$LOCKDIR"/vserver."$($_VSERVER_INFO "$VSERVER_DIR" CANONIFY)".startup + if isVserverRunning "$VSERVER_DIR"; then echo $"vserver '$VSERVER_NAME' already running; aborting..." >&2 exit 1 @@ -22,8 +25,10 @@ fi function cleanup() { + set +e + test -z "$startsync_pipe" || rm -f "$startsync_pipe" - test -z "$is_started" || return 0 + test -z "$is_started" || { unlock; return 0; } if test "$is_configured" -a -z "$is_executed"; then warning $" @@ -55,6 +60,8 @@ Failed to start vserver '$VSERVER_NAME'" test "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null test -z "$is_mounted" || umountVserver "$VSERVER_DIR" || : test -z "$have_interfaces" || disableInterfaces "$VSERVER_DIR" || : + + unlock || : } is_configured= @@ -81,11 +88,12 @@ pushd "$VSERVER_DIR"/vdir/ >/dev/null execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-start popd >/dev/null -test -z "$OPTION_DEFAULTTTY" || setDefaultTTY +test -z "$OPTION_DEFAULTTTY" || setDefaultTTY "$VSERVER_DIR" pushd "$VSERVER_DIR"/vdir/ >/dev/null is_configured=1 if $_VSERVER_INFO - FEATURE migrate; then + ${NICE_CMD[@]} \ $_CHBIND "${CHBIND_OPTS[@]}" -- \ $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ ${USE_VNAMESPACE:+$_VNAMESPACE --set -- } \ @@ -96,7 +104,7 @@ if $_VSERVER_INFO - FEATURE migrate; then $_VUNAME --xid self --set -t context="$VSERVER_DIR" -- \ $_VATTRIBUTE --set "${OPTS_VATTRIBUTE[@]}" -- \ $_SAVE_CTXINFO "$VSERVER_DIR" \ - $_CLEARENV \ + $_ENV -i -- \ $_VCONTEXT --migrate-self --endsetup --chroot $SILENT_OPT "${OPTS_VCONTEXT_MIGRATE[@]}" -- \ "${INITCMD_START[@]}" else @@ -111,7 +119,7 @@ else $_EXEC_ULIMIT "$VSERVER_DIR/ulimits" \ $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" "${CHCONTEXT_INIT_OPTS[@]}" \ $_SAVE_CTXINFO "$VSERVER_DIR" \ - $_CLEARENV \ + $_ENV -i -- \ $_CHAINECHO "${_IS_FAKEINIT:+$startsync_pipe}" "" \ $_CAPCHROOT "${CAPCHROOT_OPTS[@]}" . \ "${INITCMD_START[@]}"