geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r665749 - in /geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin: gsh gsh.bat setjavaenv.bat start-server start-server.bat stop-server stop-server.bat
Date Mon, 09 Jun 2008 16:29:48 GMT
Author: dwoods
Date: Mon Jun  9 09:29:48 2008
New Revision: 665749

URL: http://svn.apache.org/viewvc?rev=665749&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/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server
    geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh Mon Jun
 9 09:29:48 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/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/gsh.bat Mon
Jun  9 09:29:48 2008
@@ -1,82 +1,86 @@
-@if "%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
+@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 "%GERONIMO_BATCH_ECHO%" == "on"  echo on
+@if 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
+@setlocal enableextensions
+@set 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
+@REM Get standard environment variables
+@REM 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
+
+@REM 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
+@REM pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
+@endlocal

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/setjavaenv.bat
Mon Jun  9 09:29:48 2008
@@ -40,6 +40,20 @@
 @if "%GERONIMO_BATCH_ECHO%" == "on"  echo on
 @if not "%GERONIMO_BATCH_ECHO%" == "on"  echo off
 
+@REM handle spaces in provided paths
+if defined var JAVA_HOME(
+set JAVA_HOME=###%JAVA_HOME%###
+set JAVA_HOME=%JAVA_HOME:"###=%
+set JAVA_HOME=%JAVA_HOME:###"=%
+set JAVA_HOME=%JAVA_HOME:###=%
+@)
+if defined var JRE_HOME(
+set JAVA_HOME=###%JRE_HOME%###
+set JAVA_HOME=%JRE_HOME:"###=%
+set JAVA_HOME=%JRE_HOME:###"=%
+set JAVA_HOME=%JRE_HOME:###=%
+@)
+
 @REM check that either JAVA_HOME or JRE_HOME are set
 set jdkOrJreHomeSet=0
 if not "%JAVA_HOME%" == "" set jdkOrJreHomeSet=1
@@ -74,20 +88,6 @@
 @REM default JRE_HOME to JAVA_HOME if not set.
 if "%JRE_HOME%" == "" set JRE_HOME=%JAVA_HOME%\jre
 
-if not "%BASEDIR%" == "" goto gotBasedir
-echo The BASEDIR environment variable is not defined
-echo This environment variable is needed to run this program
-set ERRORLEVEL=1
-goto end
-
-:gotBasedir
-if exist "%BASEDIR%\bin\setjavaenv.bat" goto okBasedir
-echo The BASEDIR environment variable is not defined correctly
-echo This environment variable is needed to run this program
-set ERRORLEVEL=1
-goto end
-
-:okBasedir
 @REM Set standard command for invoking Java.
 @REM Note that NT requires a window name argument when using start.
 @REM Also note the quoting as JAVA_HOME may contain spaces.
@@ -95,8 +95,6 @@
 set _RUNJAVAW="%JRE_HOME%\bin\javaw"
 set _RUNJDB="%JAVA_HOME%\bin\jdb"
 
-goto end
-
 :end
 @REM pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
 if "%GERONIMO_BATCH_PAUSE%" == "on" pause

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server
Mon Jun  9 09:29:48 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/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/start-server.bat
Mon Jun  9 09:29:48 2008
@@ -1,37 +1,82 @@
-@if "%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
+@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 
+
+@rem --------------------------------------------------------------------
+@rem start-server batch file for Geronimo that starts Geronimo in foreground.
+@rem
+@rem This batch file calls the gsh.bat script passing "geronimo/start-server
+@rem followed by the arguments supplied by the caller.
+@rem
+@rem Alternatively you can use the more comprehensive gsh.bat file directly.
+@rem
+@rem Invocation Syntax:
+@rem
+@rem   start-server [geronimo_args ...]
+@rem
+@rem Environment Variable Prequisites:
+@rem
+@rem   Refer to the GShell documentation for information on environment
+@rem   variables etc.
+@rem
+@rem --------------------------------------------------------------------
+
+@if "%GERONIMO_BATCH_ECHO%" == "on"  echo on
+@if 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
+@setlocal enableextensions
+@set 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
+@REM Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo ERROR - Cannot find required script %EXECUTABLE%
+set ERRORLEVEL=1
+goto end
+
+:okExec
+@REM 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
+@REM pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
+@endlocal

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server
Mon Jun  9 09:29:48 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/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat?rev=665749&r1=665748&r2=665749&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat
(original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate/src/main/underlay/bin/stop-server.bat
Mon Jun  9 09:29:48 2008
@@ -1,37 +1,82 @@
-@if "%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
+@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 
+
+@rem --------------------------------------------------------------------
+@rem stop-server batch file for Geronimo that stops Geronimo in foreground.
+@rem
+@rem This batch file calls the gsh.bat script passing "geronimo/stop-server
+@rem followed by the arguments supplied by the caller.
+@rem
+@rem Alternatively you can use the more comprehensive gsh.bat file directly.
+@rem
+@rem Invocation Syntax:
+@rem
+@rem   stop-server [geronimo_args ...]
+@rem
+@rem Environment Variable Prequisites:
+@rem
+@rem   Refer to the GShell documentation for information on environment
+@rem   variables etc.
+@rem
+@rem --------------------------------------------------------------------
+
+@if "%GERONIMO_BATCH_ECHO%" == "on"  echo on
+@if 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
+@setlocal enableextensions
+@set 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
+@REM Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo ERROR - Cannot find required script %EXECUTABLE%
+set ERRORLEVEL=1
+goto end
+
+:okExec
+@REM 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
+@REM pause the batch file if GERONIMO_BATCH_PAUSE is set to 'on'
+if "%GERONIMO_BATCH_PAUSE%" == "on" pause
+@endlocal



Mime
View raw message