From: Enrico Scholz Date: Sat, 8 May 2004 01:33:11 +0000 (+0000) Subject: added locking X-Git-Tag: VERSION_0_10~35 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d77ffaa696534e6b97e9440154091649608399e;p=util-vserver.git added locking call setDefaultTTY() correctly git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1550 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/scripts/vserver.start b/util-vserver/scripts/vserver.start index 10aab16..f049d83 100644 --- a/util-vserver/scripts/vserver.start +++ b/util-vserver/scripts/vserver.start @@ -15,6 +15,8 @@ # 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."$(echo "$VSERVER_DIR" | tr -dc a-zA-Z0-9)".startup + if isVserverRunning "$VSERVER_DIR"; then echo $"vserver '$VSERVER_NAME' already running; aborting..." >&2 exit 1 @@ -22,8 +24,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 +59,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,7 +87,7 @@ 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 diff --git a/util-vserver/scripts/vserver.stop b/util-vserver/scripts/vserver.stop index 82e7aa6..b2365fe 100644 --- a/util-vserver/scripts/vserver.stop +++ b/util-vserver/scripts/vserver.stop @@ -15,16 +15,23 @@ # 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."$(echo "$VSERVER_DIR" | tr -dc a-zA-Z0-9)".startup + if ! isVserverRunning "$VSERVER_DIR" S_CONTEXT; then echo $"vserver '$VSERVER_NAME' is not running; aborting..." >&2 test "$OPTION_DEBUG" || exec 2>/dev/null >/dev/null umountVserver "$VSERVER_DIR" || : disableInterfaces "$VSERVER_DIR" || : + unlock exit 1 fi function cleanup { + set +e + unlock + test ! -p "$sync_fifo" || { rm -f "$sync_fifo" rmdir $(dirname "$sync_fifo") @@ -45,7 +52,7 @@ cd "$VSERVER_DIR"/vdir/ execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" pre-stop cd "$VSERVER_DIR"/vdir/ -test -z "$OPTION_DEFAULTTTY" || setDefaultTTY +test -z "$OPTION_DEFAULTTTY" || setDefaultTTY "$VSERVER_DIR" fail= if test "$_IS_FAKEINIT" && \