Setjavaenv ensures the same JVM is used for all commands and that spaces and quotes are properly handled on Windows. Otherwise, a user could use startup which uses setjavaenv (and JRE_HOME) and then stop-server which used JAVA_HOME or just _JAVACMD=java.

The OS400 support was there in the geronimo script, so I pulled that support into the gsh script.

There was some error checking in the prior startup/shutdown scripts that was missing, like checking that gsh existed before calling it from start-server/stop-server scripts.

There was some cygwin path conversions missing.

The GERONIMO_BATCH_ECHO support for Windows was missing from the new scripts.




Jason Dillon wrote:
Pffff... I really dislike all this crap in the native platform scripts. Just why is all this junk needed?

What is the os400 muck for?  Why do we care about resolving soft-links?

Why is setjavaenv.sh required?

Ugh... I think this is a mess.

--jason


On Jun 9, 2008, at 11:00 PM, [EMAIL PROTECTED] wrote:

Author: dwoods
Date: Mon Jun  9 09:00:31 2008
New Revision: 665729

URL: http://svn.apache.org/viewvc?rev=665729&view=rev
Log:
GERONIMO-4093 Enhance GShell based scripts to use setjavaenv for determining the Java runtime, allow users to continue to supply a setenv script and updated the Unix gsh script with some missing Cygwin, OS400 and error checking that was in geronimo.sh.

Modified:
geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh.bat geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server.bat geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server.bat

Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh Mon Jun 9 09:00:31 2008
@@ -22,42 +22,90 @@
## $Rev: 539227 $ $Date: 2007-05-17 19:48:49 -0700 (Thu, 17 May 2007) $
##

-DIRNAME=`dirname "$0"`
-
# OS specific support (must be 'true' or 'false').
cygwin=false
+os400=false
case "`uname`" in
-    CYGWIN*)
-        cygwin=true
-        ;;
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
esac

+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`/"$link"
+    fi
+done
+
+PRGDIR=`dirname "$PRG"`
+
+# Locate GSHELL_HOME if not it is not set
+if [ "x$GSHELL_HOME" = "x" ]; then
+    GSHELL_HOME=`cd "$PRGDIR/.."; pwd`
+fi
+
+# Execute optional environment  if provided by the user
+if [ -r "$GSHELL_HOME"/bin/setenv.sh ]; then
+    . "$GSHELL_HOME"/bin/setenv.sh
+fi
+
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
-    [ -n "$GSHELL_HOME" ] && GSHELL_HOME=`cygpath --unix "$GSHELL_HOME"`
-    [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
+    [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+    [ -n "$GSHELL_HOME" ] && GSHELL_HOME=`cygpath --unix "$GSHELL_HOME"`
fi

-# Locate GSHELL_HOME if not it is not set
-if [ "x$GSHELL_HOME" = "x" ]; then
-    GSHELL_HOME=`cd "$DIRNAME/.."; pwd`
+# For OS400
+if $os400; then
+ # Set job priority to standard for interactive (interactive - 6) by using + # the interactive priority - 6, the helper threads that respond to requests
+    # will be running at the same priority as interactive jobs.
+    COMMAND='chgjob job('$JOBNAME') runpty(6)'
+    system $COMMAND
+    # Enable multi threading
+    export QIBM_MULTI_THREADED=Y
fi

-# Determine the Java command to use to start the JVM
-if [ -z "$JAVACMD" ]; then
-    if [ -n "$JAVA_HOME" ]; then
-        JAVACMD="$JAVA_HOME/bin/java"
+# Get standard Java environment variables
+# (based upon Tomcat's setclasspath.sh but renamed since Geronimo's classpath
+# is set in the JAR manifest)
+if $os400; then
+    # -r will Only work on the os400 if the files are:
+    # 1. owned by the user
+    # 2. owned by the PRIMARY group of the user
+    # this will not work if the user belongs in secondary groups
+    BASEDIR="$GSHELL_HOME"
+    . "$GSHELL_HOME"/bin/setjavaenv.sh
+else
+    if [ -r "$GSHELL_HOME"/bin/setjavaenv.sh ]; then
+        BASEDIR="$GSHELL_HOME"
+        . "$GSHELL_HOME"/bin/setjavaenv.sh
    else
-        JAVACMD="java"
+        echo "Cannot find $GSHELL_HOME/bin/setjavaenv.sh"
+        echo "This file is needed to run this program"
+        exit 1
    fi
fi

+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
+    JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"`
+    GSHELL_HOME=`cygpath --absolute --windows "$GSHELL_HOME"`
+fi
+
BOOTJAR="$GSHELL_HOME/lib/boot/gshell-bootstrap.jar"
if $cygwin ; then
    BOOTJAR=`cygpath --windows "$BOOTJAR"`
fi

# Start the JVM
-exec "$JAVACMD" $JAVA_OPTS -jar "$BOOTJAR" "$@"
+exec "$_RUNJAVA" $JAVA_OPTS -jar "$BOOTJAR" "$@"


Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh.bat URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh.bat?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh.bat (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/gsh.bat Mon Jun 9 09:00:31 2008
@@ -1,82 +1,86 @@
[EMAIL PROTECTED] "%DEBUG%" == "" @echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one
-rem or more contributor license agreements.  See the NOTICE file
-rem distributed with this work for additional information
-rem regarding copyright ownership.  The ASF licenses this file
-rem to you under the Apache License, Version 2.0 (the
-rem "License"); you may not use this file except in compliance
-rem with the License.  You may obtain a copy of the License at
-rem
-rem  http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing,
-rem software distributed under the License is distributed on an
-rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem KIND, either express or implied.  See the License for the
-rem specific language governing permissions and limitations
-rem under the License.
-rem
-
-rem
-rem $Rev$ $Date$
-rem
-
-if "%OS%"=="Windows_NT" setlocal enableextensions
-set ERRORLEVEL=0
-
-:begin
[EMAIL PROTECTED]
[EMAIL PROTECTED] Licensed to the Apache Software Foundation (ASF) under one
[EMAIL PROTECTED] or more contributor license agreements.  See the NOTICE file
[EMAIL PROTECTED] distributed with this work for additional information
[EMAIL PROTECTED] regarding copyright ownership.  The ASF licenses this file
[EMAIL PROTECTED] to you under the Apache License, Version 2.0 (the
[EMAIL PROTECTED] "License"); you may not use this file except in compliance
[EMAIL PROTECTED] with the License.  You may obtain a copy of the License at
[EMAIL PROTECTED]
[EMAIL PROTECTED]  http://www.apache.org/licenses/LICENSE-2.0
[EMAIL PROTECTED]
[EMAIL PROTECTED] Unless required by applicable law or agreed to in writing,
[EMAIL PROTECTED] software distributed under the License is distributed on an
[EMAIL PROTECTED] "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
[EMAIL PROTECTED] KIND, either express or implied.  See the License for the
[EMAIL PROTECTED] specific language governing permissions and limitations
[EMAIL PROTECTED] under the License.
[EMAIL PROTECTED]
+
[EMAIL PROTECTED]
[EMAIL PROTECTED] $Rev$ $Date$
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] "%GERONIMO_BATCH_ECHO%" == "on"  echo on
[EMAIL PROTECTED] not "%GERONIMO_BATCH_ECHO%" == "on"  echo off
+
+if "%OS%" == "Windows_NT" goto okOsCheck
+echo Cannot process command - you are running an unsupported operating system.
+set ERRORLEVEL=1
+goto end
+
+:okOsCheck
[EMAIL PROTECTED] enableextensions
[EMAIL PROTECTED] ERRORLEVEL=0

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
+cd /d %DIRNAME%

-:check_JAVACMD
-if not "%JAVACMD%" == "" goto check_GSHELL_HOME
-
-:check_JAVA_HOME
-if not "%JAVA_HOME%" == "" goto have_JAVA_HOME
-set JAVACMD=java
-goto check_GSHELL_HOME
-
-:have_JAVA_HOME
-set JAVACMD=%JAVA_HOME%\bin\java
-goto check_GSHELL_HOME
[EMAIL PROTECTED] Get standard environment variables
[EMAIL PROTECTED] Users can optionally create this file to set environment 
variables.
+if exist "%DIRNAME%\setenv.bat" call "%DIRNAME%\setenv.bat"
+if not %errorlevel% == 0 goto end
+
[EMAIL PROTECTED] Get standard Java environment variables
+if exist "%DIRNAME%\setjavaenv.bat" goto okSetJavaEnv
+echo ERROR - Cannot find %DIRNAME%\setjavaenv.bat
+set ERRORLEVEL=1
+goto end
+:okSetJavaEnv
+set BASEDIR=%DIRNAME%
+call "%DIRNAME%\setJavaEnv.bat"
+if not %errorlevel% == 0 goto end

:check_GSHELL_HOME
if "%GSHELL_HOME%" == "" set GSHELL_HOME=%DIRNAME%..

:init
-rem Get command-line arguments, handling Windowz variants
-if not "%OS%" == "Windows_NT" goto win9xME_args
+rem Get command-line arguments, handling Windows variants
if "%eval[2+2]" == "4" goto 4NT_args

rem Regular WinNT shell
-set ARGS=%*
-goto execute
-
-:win9xME_args
-rem Slurp the command line arguments. This loop allows for an unlimited number
set ARGS=
-
-:win9xME_args_slurp
-if "x%1" == "x" goto execute
+:setArgs
+if ""%1""=="""" goto doneSetArgs
set ARGS=%ARGS% %1
shift
-goto win9xME_args_slurp
+goto setArgs
+:doneSetArgs
+goto execute

:4NT_args
rem Get arguments from the 4NT Shell from JP Software
set ARGS=%$

:execute
-
set BOOTJAR=%GSHELL_HOME%\lib\boot\gshell-bootstrap.jar

rem Start the JVM
-"%JAVACMD%" %JAVA_OPTS% -jar "%BOOTJAR%" %ARGS%
+%_RUNJAVA% %JAVA_OPTS% -jar "%BOOTJAR%" %ARGS%

:end
-
-if "%OS%"=="Windows_NT" endlocal
-if "%GSHELL_BATCH_PAUSE%" == "on" pause
-
+:end
[EMAIL PROTECTED] pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
[EMAIL PROTECTED]

Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server Mon Jun 9 09:00:31 2008
@@ -22,7 +22,61 @@
## $Rev: 539227 $ $Date: 2007-05-17 19:48:49 -0700 (Thu, 17 May 2007) $
##

-DIRNAME=`dirname "$0"`
+# --------------------------------------------------------------------
+# Startup script for Geronimo that starts Geronimo in the foreground.
+#
+# This script calls the gsh script passing "geronimo/start-server" as the
+# first argument followed by the arguments supplied by the caller.
+#
+# Alternatively you can use the more comprehensive gsh interface directly.
+#
+# Invocation Syntax:
+#
+#   start-server [geronimo_args ...]
+#
+# Environment Variable Prequisites:
+#
+#   Refer to the documentation in the gsh file for information
+#   on environment variables etc.
+#
+# --------------------------------------------------------------------
+
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG=`dirname "$PRG"`/"$link"
+  fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=gsh
+
+# Check that target executable exists
+if $os400; then
+  # -x will Only work on the os400 if the files are:
+  # 1. owned by the user
+  # 2. owned by the PRIMARY group of the user
+  # this will not work if the user belongs in secondary groups
+  eval
+else
+  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+    echo "Cannot find $PRGDIR/$EXECUTABLE"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi

ARGS=
while [ $# -ge 1 ]; do
@@ -30,5 +84,5 @@
  shift
done

-exec "$DIRNAME/gsh" -c "geronimo/start-server $ARGS"
+exec "$PRGDIR"/"$EXECUTABLE" -c "geronimo/start-server $ARGS"


Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server.bat URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server.bat?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server.bat (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/start-server.bat Mon Jun 9 09:00:31 2008
@@ -1,37 +1,82 @@
[EMAIL PROTECTED] "%DEBUG%" == "" @echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one
-rem or more contributor license agreements.  See the NOTICE file
-rem distributed with this work for additional information
-rem regarding copyright ownership.  The ASF licenses this file
-rem to you under the Apache License, Version 2.0 (the
-rem "License"); you may not use this file except in compliance
-rem with the License.  You may obtain a copy of the License at
-rem
-rem  http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing,
-rem software distributed under the License is distributed on an
-rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem KIND, either express or implied.  See the License for the
-rem specific language governing permissions and limitations
-rem under the License.
-rem
-
-rem
-rem $Rev$ $Date$
-rem
-
-if "%OS%"=="Windows_NT" setlocal
-
-:begin
[EMAIL PROTECTED]
[EMAIL PROTECTED] Licensed to the Apache Software Foundation (ASF) under one
[EMAIL PROTECTED] or more contributor license agreements.  See the NOTICE file
[EMAIL PROTECTED] distributed with this work for additional information
[EMAIL PROTECTED] regarding copyright ownership.  The ASF licenses this file
[EMAIL PROTECTED] to you under the Apache License, Version 2.0 (the
[EMAIL PROTECTED] "License"); you may not use this file except in compliance
[EMAIL PROTECTED] with the License.  You may obtain a copy of the License at
[EMAIL PROTECTED]
[EMAIL PROTECTED]  http://www.apache.org/licenses/LICENSE-2.0
[EMAIL PROTECTED]
[EMAIL PROTECTED] Unless required by applicable law or agreed to in writing,
[EMAIL PROTECTED] software distributed under the License is distributed on an
[EMAIL PROTECTED] "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
[EMAIL PROTECTED] KIND, either express or implied.  See the License for the
[EMAIL PROTECTED] specific language governing permissions and limitations
[EMAIL PROTECTED] under the License.
[EMAIL PROTECTED]
+
[EMAIL PROTECTED]
[EMAIL PROTECTED] $Rev$ $Date$
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] -------------------------------------------------------------------- [EMAIL PROTECTED] start-server batch file for Geronimo that starts Geronimo in foreground.
[EMAIL PROTECTED]
[EMAIL PROTECTED] This batch file calls the gsh.bat script passing "geronimo/start-server
[EMAIL PROTECTED] followed by the arguments supplied by the caller.
[EMAIL PROTECTED]
[EMAIL PROTECTED] Alternatively you can use the more comprehensive gsh.bat file directly.
[EMAIL PROTECTED]
[EMAIL PROTECTED] Invocation Syntax:
[EMAIL PROTECTED]
[EMAIL PROTECTED]   start-server [geronimo_args ...]
[EMAIL PROTECTED]
[EMAIL PROTECTED] Environment Variable Prequisites:
[EMAIL PROTECTED]
[EMAIL PROTECTED]   Refer to the GShell documentation for information on 
environment
[EMAIL PROTECTED]   variables etc.
[EMAIL PROTECTED]
[EMAIL PROTECTED] --------------------------------------------------------------------
+
[EMAIL PROTECTED] "%GERONIMO_BATCH_ECHO%" == "on"  echo on
[EMAIL PROTECTED] not "%GERONIMO_BATCH_ECHO%" == "on"  echo off
+
+if "%OS%"=="Windows_NT" goto okOsCheck
+echo Cannot process command - you are running an unsupported operating system.
+set ERRORLEVEL=1
+goto end
+
+:okOsCheck
[EMAIL PROTECTED] enableextensions
[EMAIL PROTECTED] ERRORLEVEL=0

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
+cd /d %DIRNAME%

-"%DIRNAME%\gsh.bat" -c "geronimo/start-server %*"
+set EXECUTABLE=%DIRNAME%\gsh.bat

-:end
[EMAIL PROTECTED] Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo ERROR - Cannot find required script %EXECUTABLE%
+set ERRORLEVEL=1
+goto end
+
+:okExec
[EMAIL PROTECTED] Get remaining unshifted command line arguments and save them 
in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs

-if "%OS%"=="Windows_NT" endlocal
+call "%EXECUTABLE%" -c "geronimo/start-server %CMD_LINE_ARGS%"

+:end
[EMAIL PROTECTED] pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
[EMAIL PROTECTED]

Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server Mon Jun 9 09:00:31 2008
@@ -22,7 +22,61 @@
## $Rev: 539227 $ $Date: 2007-05-17 19:48:49 -0700 (Thu, 17 May 2007) $
##

-DIRNAME=`dirname "$0"`
+# --------------------------------------------------------------------
+# Shutdown script for Geronimo that stops Geronimo in the foreground.
+#
+# This script calls the gsh script passing "geronimo/stop-server" as the
+# first argument followed by the arguments supplied by the caller.
+#
+# Alternatively you can use the more comprehensive gsh interface directly.
+#
+# Invocation Syntax:
+#
+#   stop-server [geronimo_args ...]
+#
+# Environment Variable Prequisites:
+#
+#   Refer to the documentation in the gsh file for information
+#   on environment variables etc.
+#
+# --------------------------------------------------------------------
+
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG=`dirname "$PRG"`/"$link"
+  fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=gsh
+
+# Check that target executable exists
+if $os400; then
+  # -x will Only work on the os400 if the files are:
+  # 1. owned by the user
+  # 2. owned by the PRIMARY group of the user
+  # this will not work if the user belongs in secondary groups
+  eval
+else
+  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+    echo "Cannot find $PRGDIR/$EXECUTABLE"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi

ARGS=
while [ $# -ge 1 ]; do
@@ -30,5 +84,5 @@
  shift
done

-exec "$DIRNAME/gsh" -c "geronimo/stop-server $ARGS"
+exec "$PRGDIR"/"$EXECUTABLE" -c "geronimo/stop-server $ARGS"


Modified: geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server.bat URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server.bat?rev=665729&r1=665728&r2=665729&view=diff ============================================================================== --- geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server.bat (original) +++ geronimo/server/branches/2.1/assemblies/geronimo-boilerplate-minimal/src/main/underlay/bin/stop-server.bat Mon Jun 9 09:00:31 2008
@@ -1,37 +1,82 @@
[EMAIL PROTECTED] "%DEBUG%" == "" @echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one
-rem or more contributor license agreements.  See the NOTICE file
-rem distributed with this work for additional information
-rem regarding copyright ownership.  The ASF licenses this file
-rem to you under the Apache License, Version 2.0 (the
-rem "License"); you may not use this file except in compliance
-rem with the License.  You may obtain a copy of the License at
-rem
-rem  http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing,
-rem software distributed under the License is distributed on an
-rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-rem KIND, either express or implied.  See the License for the
-rem specific language governing permissions and limitations
-rem under the License.
-rem
-
-rem
-rem $Rev$ $Date$
-rem
-
-if "%OS%"=="Windows_NT" setlocal
-
-:begin
[EMAIL PROTECTED]
[EMAIL PROTECTED] Licensed to the Apache Software Foundation (ASF) under one
[EMAIL PROTECTED] or more contributor license agreements.  See the NOTICE file
[EMAIL PROTECTED] distributed with this work for additional information
[EMAIL PROTECTED] regarding copyright ownership.  The ASF licenses this file
[EMAIL PROTECTED] to you under the Apache License, Version 2.0 (the
[EMAIL PROTECTED] "License"); you may not use this file except in compliance
[EMAIL PROTECTED] with the License.  You may obtain a copy of the License at
[EMAIL PROTECTED]
[EMAIL PROTECTED]  http://www.apache.org/licenses/LICENSE-2.0
[EMAIL PROTECTED]
[EMAIL PROTECTED] Unless required by applicable law or agreed to in writing,
[EMAIL PROTECTED] software distributed under the License is distributed on an
[EMAIL PROTECTED] "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
[EMAIL PROTECTED] KIND, either express or implied.  See the License for the
[EMAIL PROTECTED] specific language governing permissions and limitations
[EMAIL PROTECTED] under the License.
[EMAIL PROTECTED]
+
[EMAIL PROTECTED]
[EMAIL PROTECTED] $Rev$ $Date$
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] -------------------------------------------------------------------- [EMAIL PROTECTED] stop-server batch file for Geronimo that stops Geronimo in foreground.
[EMAIL PROTECTED]
[EMAIL PROTECTED] This batch file calls the gsh.bat script passing "geronimo/stop-server
[EMAIL PROTECTED] followed by the arguments supplied by the caller.
[EMAIL PROTECTED]
[EMAIL PROTECTED] Alternatively you can use the more comprehensive gsh.bat file directly.
[EMAIL PROTECTED]
[EMAIL PROTECTED] Invocation Syntax:
[EMAIL PROTECTED]
[EMAIL PROTECTED]   stop-server [geronimo_args ...]
[EMAIL PROTECTED]
[EMAIL PROTECTED] Environment Variable Prequisites:
[EMAIL PROTECTED]
[EMAIL PROTECTED]   Refer to the GShell documentation for information on 
environment
[EMAIL PROTECTED]   variables etc.
[EMAIL PROTECTED]
[EMAIL PROTECTED] --------------------------------------------------------------------
+
[EMAIL PROTECTED] "%GERONIMO_BATCH_ECHO%" == "on"  echo on
[EMAIL PROTECTED] not "%GERONIMO_BATCH_ECHO%" == "on"  echo off
+
+if "%OS%"=="Windows_NT" goto okOsCheck
+echo Cannot process command - you are running an unsupported operating system.
+set ERRORLEVEL=1
+goto end
+
+:okOsCheck
[EMAIL PROTECTED] enableextensions
[EMAIL PROTECTED] ERRORLEVEL=0

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
+cd /d %DIRNAME%

-"%DIRNAME%\gsh.bat" -c "geronimo/stop-server %*"
+set EXECUTABLE=%DIRNAME%\gsh.bat

-:end
[EMAIL PROTECTED] Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo ERROR - Cannot find required script %EXECUTABLE%
+set ERRORLEVEL=1
+goto end
+
+:okExec
[EMAIL PROTECTED] Get remaining unshifted command line arguments and save them 
in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs

-if "%OS%"=="Windows_NT" endlocal
+call "%EXECUTABLE%" -c "geronimo/stop-server %CMD_LINE_ARGS%"

+:end
[EMAIL PROTECTED] pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
[EMAIL PROTECTED]




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to