You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/04/19 21:41:37 UTC

svn commit: r935712 [1/2] - in /geronimo/server/trunk/framework/configs/karaf-framework/src/main: distribution/unix-shell/bin/ distribution/windows-text/bin/ filtered-resources/bin/

Author: gawor
Date: Mon Apr 19 19:41:37 2010
New Revision: 935712

URL: http://svn.apache.org/viewvc?rev=935712&view=rev
Log:
GERONIMO-5213: Clean up Geronimo shell and batch scripts. The geronimo, client, deploy, shutdown, and startup scripts work and behave just like they used to (as in Geronimo 2.2)

Added:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh   (with props)
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup   (with props)
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/setjavaenv.bat   (with props)
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/startup.bat   (with props)
Removed:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/start
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/stop
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/start.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/stop.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/bin/admin
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/bin/admin.bat
Modified:
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/client.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/deploy.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/geronimo.bat
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/windows-text/bin/shutdown.bat

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client?rev=935712&r1=935711&r2=935712&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/client Mon Apr 19 19:41:37 2010
@@ -1,296 +1,207 @@
 #!/bin/sh
 #
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-# $Id: karaf 979 2005-11-30 22:50:55Z bsnyder $
-#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev: 575171 $ $Date: 2007-09-13 01:15:48 -0400 (Thu, 13 Sep 2007) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Client Script for the Geronimo Server
+#
+# You should not have to edit this file.  If you wish to have environment
+# variables set each time you run this script refer to the information
+# on the setenv.sh script that is called by this script below. 
+#
+# Invocation Syntax:
+#
+#   client [general options] app client module name [app client arguments]
+#
+#   For detailed command usage information, just run client without any 
+#   arguments.
+#
+# Environment Variable Prequisites:
+#
+#   GERONIMO_HOME   (Optional) May point at your Geronimo top-level directory.
+#                   If not specified, it will default to the parent directory
+#                   of the location of this script.
+#
+#   GERONIMO_OPTS   (Optional) Java runtime options.
+#
+#   GERONIMO_TMPDIR (Optional) Directory path location of temporary directory
+#                   the JVM should use (java.io.tmpdir). Defaults to var/temp
+#                   (resolved to server instance directory).
+#
+#   JAVA_HOME       Points to your Java Development Kit installation.
+#                   JAVA_HOME doesn't need to be set if JRE_HOME is set.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JRE_HOME        Points to your Java Runtime Environment installation.
+#                   Set this if you wish to run Geronimo using the JRE 
+#                   instead of the JDK. Defaults to JAVA_HOME if empty.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JAVA_OPTS       (Optional) Java runtime options.
+#
+# Troubleshooting execution of this script file:
+#
+#  GERONIMO_ENV_INFO    (Optional) Environment variable that when set to
+#                       "on" (the default) outputs the 
+#                       values of GERONIMO_HOME, 
+#                       GERONIMO_TMPDIR, JAVA_HOME, JRE_HOME before
+#                       the command is issued. Set to "off" if you
+#                       do want to see this information.
+#
+# Scripts called by this script:
+# 
+#   $GERONIMO_HOME/bin/setenv.sh
+#                   (Optional) This script file is called if it is present.
+#                   Its contents may set one or more of the above environment
+#                   variables.  It is preferable (to simplify migration to
+#                   future Geronimo releases) to set environment variables
+#                   in this file rather than modifying Geronimo's script files.
+#
+#   $GERONIMO_HOME/bin/setjavaenv.sh
+#                   This batch file is called to set environment variables
+#                   relating to the java or jdb executable to invoke.
+#                   This file should not need to be modified.
+#
+# Exit Codes:
+#
+#  0 - Success
+#  1 - Error
+# -----------------------------------------------------------------------------
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false
+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
 
-DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
 
-#
-# Check/Set up some easily accessible MIN/MAX params for JVM mem usage
-#
+# Only set GERONIMO_HOME if not already set
+[ -z "$GERONIMO_HOME" ] && GERONIMO_HOME=`cd "$PRGDIR/.." ; pwd`
 
-if [ "x$JAVA_MIN_MEM" = "x" ]; then
-    JAVA_MIN_MEM=128M
-    export JAVA_MIN_MEM
+if [ -r "$GERONIMO_HOME"/bin/setenv.sh ]; then
+  . "$GERONIMO_HOME"/bin/setenv.sh
 fi
 
-if [ "x$JAVA_MAX_MEM" = "x" ]; then
-    JAVA_MAX_MEM=512M
-    export JAVA_MAX_MEM
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+  [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
+  [ -n "$GERONIMO_HOME" ] && GERONIMO_HOME=`cygpath --unix "$GERONIMO_HOME"`
 fi
 
-warn() {
-    echo "${PROGNAME}: $*"
-}
+# 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
 
-die() {
-    warn "$*"
+# 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="$GERONIMO_HOME"
+  . "$GERONIMO_HOME"/bin/setjavaenv.sh 
+else
+  if [ -r "$GERONIMO_HOME"/bin/setjavaenv.sh ]; then
+    BASEDIR="$GERONIMO_HOME"
+    . "$GERONIMO_HOME"/bin/setjavaenv.sh
+  else
+    echo "Cannot find $GERONIMO_HOME/bin/setjavaenv.sh"
+    echo "This file is needed to run this program"
     exit 1
-}
+  fi
+fi
+
+if [ -z "$GERONIMO_TMPDIR" ] ; then
+  # Define the java.io.tmpdir to use for Geronimo
+  GERONIMO_TMPDIR=var/temp
+fi
 
-maybeSource() {
-    file="$1"
-    if [ -f "$file" ] ; then
-        . $file
-    fi
-}
-
-detectOS() {
-    # OS specific support (must be 'true' or 'false').
-    cygwin=false;
-    darwin=false;
-    aix=false;
-    os400=false;
-    case "`uname`" in
-        CYGWIN*)
-            cygwin=true
-            ;;
-        Darwin*)
-            darwin=true
-            ;;
-        AIX*)
-            aix=true
-            ;;
-        OS400*)
-            os400=true
-            ;;
-    esac
-    # For AIX, set an environment variable
-    if $aix; then
-         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
-         export IBM_JAVA_HEAPDUMP_TEXT=true
-         echo $LDR_CNTRL
-    fi
-}
-
-unlimitFD() {
-    # Use the maximum available, or set MAX_FD != -1 to use that
-    if [ "x$MAX_FD" = "x" ]; then
-        MAX_FD="maximum"
-    fi
-
-    # Increase the maximum file descriptors if we can
-    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
-        MAX_FD_LIMIT=`ulimit -H -n`
-        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
-            if [ $? -eq 0 ]; then
-                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-                    # use the system max
-                    MAX_FD="$MAX_FD_LIMIT"
-                fi
-
-                ulimit -n $MAX_FD > /dev/null
-                # echo "ulimit -n" `ulimit -n`
-                if [ $? -ne 0 ]; then
-                    warn "Could not set maximum file descriptor limit: $MAX_FD"
-                fi
-            else
-                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
-            fi
-        fi
-    fi
-}
-
-locateHome() {
-    if [ "x$KARAF_HOME" != "x" ]; then
-        warn "Ignoring predefined value for KARAF_HOME"
-    fi
-    
-    # In POSIX shells, CDPATH may cause cd to write to stdout
-    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-    KARAF_HOME=`cd $DIRNAME/..; pwd`
-    if [ ! -d "$KARAF_HOME" ]; then
-        die "KARAF_HOME is not valid: $KARAF_HOME"
-    fi
-}
-
-locateBase() {
-    if [ "x$KARAF_BASE" != "x" ]; then
-        if [ ! -d "$KARAF_BASE" ]; then
-            die "KARAF_BASE is not valid: $KARAF_BASE"
-        fi
-    else
-        KARAF_BASE=$KARAF_HOME
-    fi
-}
-
-setupNativePath() {
-    # Support for loading native libraries
-    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
-
-    # For Cygwin, set PATH from LD_LIBRARY_PATH
-    if $cygwin; then
-        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
-        PATH="$PATH;$LD_LIBRARY_PATH"
-        export PATH
-    fi
-    export LD_LIBRARY_PATH
-}
-
-locateJava() {
-    # Setup the Java Virtual Machine
-    if $cygwin ; then
-        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
-        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    fi
-
-    if [ "x$JAVA" = "x" ]; then
-        if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
-            JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-        fi
-        if [ "x$JAVA_HOME" != "x" ]; then
-            if [ ! -d "$JAVA_HOME" ]; then
-                die "JAVA_HOME is not valid: $JAVA_HOME"
-            fi
-            JAVA="$JAVA_HOME/bin/java"
-        else
-            warn "JAVA_HOME not set; results may vary"
-            JAVA="java"
-        fi
-    fi
-}
-
-detectJVM() {
-   #echo "`$JAVA -version`"
-   # This service should call `java -version`,
-   # read stdout, and look for hints
-   if $JAVA -version 2>&1 | grep "^IBM" ; then
-       JVM_VENDOR="IBM"
-   # on OS/400, java -version does not contain IBM explicitly
-   elif $os400; then
-       JVM_VENDOR="IBM"
-   else
-       JVM_VENDOR="SUN"
-   fi
-   # echo "JVM vendor is $JVM_VENDOR"
-}
-
-setupDebugOptions() {
-    if [ "x$JAVA_OPTS" = "x" ]; then
-        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-    fi
-    export JAVA_OPTS
-
-    # Set Debug options if enabled
-    if [ "x$KARAF_DEBUG" != "x" ]; then
-        # Use the defaults if JAVA_DEBUG_OPTS was not set
-        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
-            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
-        fi
-
-        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
-        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
-    fi
-}
-
-setupDefaults() {
-    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM "
-
-    #Set the JVM_VENDOR specific JVM flags
-    if [ "$JVM_VENDOR" = "SUN" ]; then
-        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
-    elif [ "$JVM_VENDOR" = "IBM" ]; then
-        if $os400; then
-            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-        elif $aix; then
-            DEFAULT_JAVA_OPTS="-Xverify:none -Xlp $DEFAULT_JAVA_OPTS"
-        else
-            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
-        fi
-    fi
-
-    # Add the jars in the lib dir
-    for file in $KARAF_HOME/lib/*.jar
-    do
-        if [ -z "$CLASSPATH" ]; then
-            CLASSPATH="$file"
-        else
-            CLASSPATH="$CLASSPATH:$file"
-        fi
-    done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
-    ##
-    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
-    ##
-    # Uncomment to enable YourKit profiling
-    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
-}
-
-init() {
-    # Determine if there is special OS handling we must perform
-    detectOS
-
-    # Unlimit the number of file descriptors if possible
-    unlimitFD
-
-    # Locate the Karaf home directory
-    locateHome
-
-    # Locate the Karaf base directory
-    locateBase
-
-    # Setup the native library path
-    setupNativePath
-
-    # Locate the Java VM to execute
-    locateJava
-
-    # Determine the JVM vendor
-    detectJVM
-
-    # Setup default options
-    setupDefaults
-
-    # Install debug options
-    setupDebugOptions
-
-}
-
-run() {
-    OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-    case "$1" in
-        'console')
-            shift
-            ;;
-        'server')
-            OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-            shift
-            ;;
-        'client')
-            OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false"
-            shift
-            ;;
-    esac
-
-    if $cygwin; then
-        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
-        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
-        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-    fi
-    exec $JAVA $JAVA_OPTS -Dorg.apache.geronimo.home.dir="$KARAF_HOME" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties $OPTS -classpath "$CLASSPATH" org.apache.geronimo.cli.client.ClientCLI "$@"
-}
-
-main() {
-    init
-    run "$@"
-}
+# Classpath: Add the jars in the lib dir
+for file in $GERONIMO_HOME/lib/*.jar
+do
+  if [ -z "$CLASSPATH" ]; then
+    CLASSPATH="$file"
+  else
+    CLASSPATH="$CLASSPATH:$file"
+  fi
+done
+
+# Extension dirs
+EXT_DIRS="$GERONIMO_HOME/lib/ext:$JRE_HOME/lib/ext"
+# Endorsed dirs
+ENDORSED_DIRS="$GERONIMO_HOME/lib/endorsed:$JRE_HOME/lib/endorsed"
+
+# 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"`
+  GERONIMO_HOME=`cygpath --absolute --windows "$GERONIMO_HOME"`
+  GERONIMO_TMPDIR=`cygpath --windows "$GERONIMO_TMPDIR"`
+  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  EXT_DIRS=`cygpath --path --windows "$EXT_DIRS"`
+  ENDORSED_DIRS=`cygpath --path --windows "$ENDORSED_DIRS"`
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+if [ "$GERONIMO_ENV_INFO" != "off" ] ; then
+  echo "Using GERONIMO_HOME:   $GERONIMO_HOME"
+  echo "Using GERONIMO_TMPDIR: $GERONIMO_TMPDIR"
+  echo "Using JRE_HOME:        $JRE_HOME"
+fi
 
-main "$@"
+exec "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+  -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=false \
+  -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+  -Dkaraf.home="$GERONIMO_HOME" \
+  -Dkaraf.base="$GERONIMO_HOME" \
+  -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+  -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+  -Djava.ext.dirs="$EXT_DIRS" \
+  -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+  -classpath "$CLASSPATH" \
+  org.apache.geronimo.cli.client.ClientCLI "$@"

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy?rev=935712&r1=935711&r2=935712&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/deploy Mon Apr 19 19:41:37 2010
@@ -1,296 +1,207 @@
 #!/bin/sh
 #
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-# $Id: karaf 979 2005-11-30 22:50:55Z bsnyder $
-#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev: 926934 $ $Date: 2010-03-24 01:02:39 -0400 (Wed, 24 Mar 2010) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Deploy Script for the Geronimo Server
+#
+# You should not have to edit this file.  If you wish to have environment
+# variables set each time you run this script refer to the information
+# on the setenv.sh script that is called by this script below. 
+#
+# Invocation Syntax:
+#
+#   deploy [general options] command [command options] 
+#
+#   For detailed command usage information, just run deploy without any 
+#   arguments.
+#
+# Environment Variable Prequisites:
+#
+#   GERONIMO_HOME   (Optional) May point at your Geronimo top-level directory.
+#                   If not specified, it will default to the parent directory
+#                   of the location of this script.
+#
+#   GERONIMO_OPTS   (Optional) Java runtime options.
+#
+#   GERONIMO_TMPDIR (Optional) Directory path location of temporary directory
+#                   the JVM should use (java.io.tmpdir). Defaults to var/temp
+#                   (resolved to server instance directory).
+#
+#   JAVA_HOME       Points to your Java Development Kit installation.
+#                   JAVA_HOME doesn't need to be set if JRE_HOME is set.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JRE_HOME        Points to your Java Runtime Environment installation.
+#                   Set this if you wish to run Geronimo using the JRE 
+#                   instead of the JDK. Defaults to JAVA_HOME if empty.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JAVA_OPTS       (Optional) Java runtime options.
+#
+# Troubleshooting execution of this script file:
+#
+#  GERONIMO_ENV_INFO    (Optional) Environment variable that when set to
+#                       "on" (the default) outputs the 
+#                       values of GERONIMO_HOME, 
+#                       GERONIMO_TMPDIR, JAVA_HOME, JRE_HOME before
+#                       the command is issued. Set to "off" if you
+#                       do want to see this information.
+#
+# Scripts called by this script:
+# 
+#   $GERONIMO_HOME/bin/setenv.sh
+#                   (Optional) This script file is called if it is present.
+#                   Its contents may set one or more of the above environment
+#                   variables.  It is preferable (to simplify migration to
+#                   future Geronimo releases) to set environment variables
+#                   in this file rather than modifying Geronimo's script files.
+#
+#   $GERONIMO_HOME/bin/setjavaenv.sh
+#                   This batch file is called to set environment variables
+#                   relating to the java or jdb executable to invoke.
+#                   This file should not need to be modified.
+#
+# Exit Codes:
+#
+#  0 - Success
+#  1 - Error
+# -----------------------------------------------------------------------------
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false
+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
 
-DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
 
-#
-# Check/Set up some easily accessible MIN/MAX params for JVM mem usage
-#
+# Only set GERONIMO_HOME if not already set
+[ -z "$GERONIMO_HOME" ] && GERONIMO_HOME=`cd "$PRGDIR/.." ; pwd`
 
-if [ "x$JAVA_MIN_MEM" = "x" ]; then
-    JAVA_MIN_MEM=128M
-    export JAVA_MIN_MEM
+if [ -r "$GERONIMO_HOME"/bin/setenv.sh ]; then
+  . "$GERONIMO_HOME"/bin/setenv.sh
 fi
 
-if [ "x$JAVA_MAX_MEM" = "x" ]; then
-    JAVA_MAX_MEM=512M
-    export JAVA_MAX_MEM
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+  [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
+  [ -n "$GERONIMO_HOME" ] && GERONIMO_HOME=`cygpath --unix "$GERONIMO_HOME"`
 fi
 
-warn() {
-    echo "${PROGNAME}: $*"
-}
+# 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
 
-die() {
-    warn "$*"
+# 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="$GERONIMO_HOME"
+  . "$GERONIMO_HOME"/bin/setjavaenv.sh 
+else
+  if [ -r "$GERONIMO_HOME"/bin/setjavaenv.sh ]; then
+    BASEDIR="$GERONIMO_HOME"
+    . "$GERONIMO_HOME"/bin/setjavaenv.sh
+  else
+    echo "Cannot find $GERONIMO_HOME/bin/setjavaenv.sh"
+    echo "This file is needed to run this program"
     exit 1
-}
+  fi
+fi
+
+if [ -z "$GERONIMO_TMPDIR" ] ; then
+  # Define the java.io.tmpdir to use for Geronimo
+  GERONIMO_TMPDIR=var/temp
+fi
 
-maybeSource() {
-    file="$1"
-    if [ -f "$file" ] ; then
-        . $file
-    fi
-}
-
-detectOS() {
-    # OS specific support (must be 'true' or 'false').
-    cygwin=false;
-    darwin=false;
-    aix=false;
-    os400=false;
-    case "`uname`" in
-        CYGWIN*)
-            cygwin=true
-            ;;
-        Darwin*)
-            darwin=true
-            ;;
-        AIX*)
-            aix=true
-            ;;
-        OS400*)
-            os400=true
-            ;;
-    esac
-    # For AIX, set an environment variable
-    if $aix; then
-         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
-         export IBM_JAVA_HEAPDUMP_TEXT=true
-         echo $LDR_CNTRL
-    fi
-}
-
-unlimitFD() {
-    # Use the maximum available, or set MAX_FD != -1 to use that
-    if [ "x$MAX_FD" = "x" ]; then
-        MAX_FD="maximum"
-    fi
-
-    # Increase the maximum file descriptors if we can
-    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
-        MAX_FD_LIMIT=`ulimit -H -n`
-        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
-            if [ $? -eq 0 ]; then
-                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-                    # use the system max
-                    MAX_FD="$MAX_FD_LIMIT"
-                fi
-
-                ulimit -n $MAX_FD > /dev/null
-                # echo "ulimit -n" `ulimit -n`
-                if [ $? -ne 0 ]; then
-                    warn "Could not set maximum file descriptor limit: $MAX_FD"
-                fi
-            else
-                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
-            fi
-        fi
-    fi
-}
-
-locateHome() {
-    if [ "x$KARAF_HOME" != "x" ]; then
-        warn "Ignoring predefined value for KARAF_HOME"
-    fi
-    
-    # In POSIX shells, CDPATH may cause cd to write to stdout
-    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-    KARAF_HOME=`cd $DIRNAME/..; pwd`
-    if [ ! -d "$KARAF_HOME" ]; then
-        die "KARAF_HOME is not valid: $KARAF_HOME"
-    fi
-}
-
-locateBase() {
-    if [ "x$KARAF_BASE" != "x" ]; then
-        if [ ! -d "$KARAF_BASE" ]; then
-            die "KARAF_BASE is not valid: $KARAF_BASE"
-        fi
-    else
-        KARAF_BASE=$KARAF_HOME
-    fi
-}
-
-setupNativePath() {
-    # Support for loading native libraries
-    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
-
-    # For Cygwin, set PATH from LD_LIBRARY_PATH
-    if $cygwin; then
-        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
-        PATH="$PATH;$LD_LIBRARY_PATH"
-        export PATH
-    fi
-    export LD_LIBRARY_PATH
-}
-
-locateJava() {
-    # Setup the Java Virtual Machine
-    if $cygwin ; then
-        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
-        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    fi
-
-    if [ "x$JAVA" = "x" ]; then
-        if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
-            JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-        fi
-        if [ "x$JAVA_HOME" != "x" ]; then
-            if [ ! -d "$JAVA_HOME" ]; then
-                die "JAVA_HOME is not valid: $JAVA_HOME"
-            fi
-            JAVA="$JAVA_HOME/bin/java"
-        else
-            warn "JAVA_HOME not set; results may vary"
-            JAVA="java"
-        fi
-    fi
-}
-
-detectJVM() {
-   #echo "`$JAVA -version`"
-   # This service should call `java -version`,
-   # read stdout, and look for hints
-   if $JAVA -version 2>&1 | grep "^IBM" ; then
-       JVM_VENDOR="IBM"
-   # on OS/400, java -version does not contain IBM explicitly
-   elif $os400; then
-       JVM_VENDOR="IBM"
-   else
-       JVM_VENDOR="SUN"
-   fi
-   # echo "JVM vendor is $JVM_VENDOR"
-}
-
-setupDebugOptions() {
-    if [ "x$JAVA_OPTS" = "x" ]; then
-        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-    fi
-    export JAVA_OPTS
-
-    # Set Debug options if enabled
-    if [ "x$KARAF_DEBUG" != "x" ]; then
-        # Use the defaults if JAVA_DEBUG_OPTS was not set
-        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
-            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
-        fi
-
-        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
-        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
-    fi
-}
-
-setupDefaults() {
-    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM "
-
-    #Set the JVM_VENDOR specific JVM flags
-    if [ "$JVM_VENDOR" = "SUN" ]; then
-        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
-    elif [ "$JVM_VENDOR" = "IBM" ]; then
-        if $os400; then
-            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-        elif $aix; then
-            DEFAULT_JAVA_OPTS="-Xverify:none -Xlp $DEFAULT_JAVA_OPTS"
-        else
-            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
-        fi
-    fi
-
-    # Add the jars in the lib dir
-    for file in $KARAF_HOME/lib/*.jar
-    do
-        if [ -z "$CLASSPATH" ]; then
-            CLASSPATH="$file"
-        else
-            CLASSPATH="$CLASSPATH:$file"
-        fi
-    done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
-    ##
-    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
-    ##
-    # Uncomment to enable YourKit profiling
-    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
-}
-
-init() {
-    # Determine if there is special OS handling we must perform
-    detectOS
-
-    # Unlimit the number of file descriptors if possible
-    unlimitFD
-
-    # Locate the Karaf home directory
-    locateHome
-
-    # Locate the Karaf base directory
-    locateBase
-
-    # Setup the native library path
-    setupNativePath
-
-    # Locate the Java VM to execute
-    locateJava
-
-    # Determine the JVM vendor
-    detectJVM
-
-    # Setup default options
-    setupDefaults
-
-    # Install debug options
-    setupDebugOptions
-
-}
-
-run() {
-    OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-    case "$1" in
-        'console')
-            shift
-            ;;
-        'server')
-            OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-            shift
-            ;;
-        'client')
-            OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false"
-            shift
-            ;;
-    esac
-
-    if $cygwin; then
-        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
-        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
-        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-    fi
-    exec $JAVA $JAVA_OPTS -Dorg.apache.geronimo.home.dir="$KARAF_HOME" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties $OPTS -classpath "$CLASSPATH" org.apache.geronimo.cli.deployer.DeployerCLI "$@"
-}
-
-main() {
-    init
-    run "$@"
-}
+# Classpath: Add the jars in the lib dir
+for file in $GERONIMO_HOME/lib/*.jar
+do
+  if [ -z "$CLASSPATH" ]; then
+    CLASSPATH="$file"
+  else
+    CLASSPATH="$CLASSPATH:$file"
+  fi
+done
+
+# Extension dirs
+EXT_DIRS="$GERONIMO_HOME/lib/ext:$JRE_HOME/lib/ext"
+# Endorsed dirs
+ENDORSED_DIRS="$GERONIMO_HOME/lib/endorsed:$JRE_HOME/lib/endorsed"
+
+# 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"`
+  GERONIMO_HOME=`cygpath --absolute --windows "$GERONIMO_HOME"`
+  GERONIMO_TMPDIR=`cygpath --windows "$GERONIMO_TMPDIR"`
+  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  EXT_DIRS=`cygpath --path --windows "$EXT_DIRS"`
+  ENDORSED_DIRS=`cygpath --path --windows "$ENDORSED_DIRS"`
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+if [ "$GERONIMO_ENV_INFO" != "off" ] ; then
+  echo "Using GERONIMO_HOME:   $GERONIMO_HOME"
+  echo "Using GERONIMO_TMPDIR: $GERONIMO_TMPDIR"
+  echo "Using JRE_HOME:        $JRE_HOME"
+fi
 
-main "$@"
+exec "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+  -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=false \
+  -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+  -Dkaraf.home="$GERONIMO_HOME" \
+  -Dkaraf.base="$GERONIMO_HOME" \
+  -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+  -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+  -Djava.ext.dirs="$EXT_DIRS" \
+  -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+  -classpath "$CLASSPATH" \
+  org.apache.geronimo.cli.deployer.DeployerCLI "$@"

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo?rev=935712&r1=935711&r2=935712&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/geronimo Mon Apr 19 19:41:37 2010
@@ -1,312 +1,447 @@
 #!/bin/sh
 #
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
 #
-#       http://www.apache.org/licenses/LICENSE-2.0
+#      http://www.apache.org/licenses/LICENSE-2.0
 #
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev: 826768 $ $Date: 2009-10-19 15:10:35 -0400 (Mon, 19 Oct 2009) $
+# --------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# Start/Stop Script for the Geronimo Server
 #
-# $Id: karaf 979 2005-11-30 22:50:55Z bsnyder $
+# This script is based upon Tomcat's catalina.sh file to enable
+# those familiar with Tomcat to quickly get started with Geronimo.
 #
-
-DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
-
+# This script file can be used directly instead of startup.sh and
+# shutdown.sh as they call this script file anyway.
 #
-# Check/Set up some easily accessible MIN/MAX params for JVM mem usage
+# You should not have to edit this file.  If you wish to have environment
+# variables set each time you run this script refer to the information
+# on the setenv.sh script that is called by this script below.
 #
+# Invocation Syntax:
+#
+#   geronimo command [geronimo_args]
+#
+#   For detailed command usage information, just run geronimo without any
+#   arguments.
+#
+# Environment Variable Prequisites:
+#
+#   GERONIMO_HOME   (Optional) May point at your Geronimo top-level directory.
+#                   If not specified, it will default to the parent directory
+#                   of the location of this script.
+#
+#   GERONIMO_OPTS   (Optional) Java runtime options used when the "start",
+#                   "stop", or "run" command is executed.
+#
+#   GERONIMO_OUT    (Optional) File that Geronimo's stdout and stderr streams
+#                   will be redirected to if Geronimo is started in the
+#                   background.
+#                   Defaults to $GERONIMO_HOME/var/log/geronimo.out
+#
+#   GERONIMO_PID    (Optional) Path of the file which should contains the pid
+#                   of the Geronimo java process, when start (fork) is used
+#
+#   GERONIMO_TMPDIR (Optional) Directory path location of temporary directory
+#                   the JVM should use (java.io.tmpdir). Defaults to var/temp 
+#                   (resolved to server instance directory).
+#
+#   JAVA_HOME       Points to your Java Development Kit installation.
+#                   JAVA_HOME doesn't need to be set if JRE_HOME is set
+#                   unless you use the "debug" command.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JRE_HOME        Points to your Java Runtime Environment installation.
+#                   Set this if you wish to run Geronimo using the JRE
+#                   instead of the JDK (except for the "debug" command).
+#                   Defaults to JAVA_HOME if empty.
+#                   It is mandatory either JAVA_HOME or JRE_HOME are set.
+#
+#   JAVA_OPTS       (Optional) Java runtime options used when the "start",
+#                   "stop", or "run" command is executed.
+#
+#   JDB_SRCPATH     (Optional) The Source Path to be used by jdb debugger
+#                   when the "debug" command is executed.
+#                   Defaults to %GERONIMO_HOME%\src
+#
+#   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
+#                   command is executed. The default is 8000.
+#
+#   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
+#                   command is executed. The default is "dt_socket".
+#
+#   JPDA_OPTS       (Optional) JPDA command line options.
+#                   Only set this if you need to use some unusual JPDA
+#                   command line options.  This overrides the use of the
+#                   other JPDA_* environment variables.
+#                   Defaults to JPDA command line options contructed from
+#                   the JPDA_ADDRESS, JPDA_SUSPEND and JPDA_TRANSPORT
+#                   environment variables.
+#
+#   JPDA_SUSPEND    (Optional) Suspend the JVM before the main class is loaded.
+#                   Valid values are 'y' and 'n'.  The default is "n".
+#
+#   START_OS_CMD    (Optional) Operating system command that will be placed in
+#                   front of the java command when starting Geronimo in the
+#                   background.  This can be useful on operating systems where
+#                   the OS provides a command that allows you to start a process
+#                   with in a specified CPU or priority.
+#
+# Troubleshooting execution of this script file:
+#
+#  GERONIMO_ENV_INFO (Optional) Environment variable that when set to "on"
+#                    (the default) outputs the values of the GERONIMO_HOME,
+#                    GERONIMO_TMPDIR, JAVA_HOME and
+#                    JRE_HOME before the command is issued. Set to "off"
+#                    if you do not want this information displayed.
+#
+# Scripts called by this script:
+#
+#   $GERONIMO_HOME/bin/setenv.sh
+#                   (Optional) This script file is called if it is present.
+#                   Its contents may set one or more of the above environment
+#                   variables.  It is preferable (to simplify migration to
+#                   future Geronimo releases) to set environment variables
+#                   in this file rather than modifying Geronimo's script files.
+#
+#   $GERONIMO_HOME/bin/setjavaenv.sh
+#                   This batch file is called to set environment variables
+#                   relating to the java or jdb executable to invoke.
+#                   This file should not need to be modified.
+#
+# Exit Codes:
+#
+#  0 - Success
+#  1 - Error
+# -----------------------------------------------------------------------------
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false
+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
 
-if [ "x$JAVA_MIN_MEM" = "x" ]; then
-    JAVA_MIN_MEM=128M
-    export JAVA_MIN_MEM
-fi
-
-if [ "x$JAVA_MAX_MEM" = "x" ]; then
-    JAVA_MAX_MEM=512M
-    export JAVA_MAX_MEM
-fi
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
 
-warn() {
-    echo "${PROGNAME}: $*"
-}
+# Only set GERONIMO_HOME if not already set
+[ -z "$GERONIMO_HOME" ] && GERONIMO_HOME=`cd "$PRGDIR/.." ; pwd`
 
-die() {
-    warn "$*"
-    exit 1
-}
+if [ -r "$GERONIMO_HOME"/bin/setenv.sh ]; then
+  . "$GERONIMO_HOME"/bin/setenv.sh
+fi
 
-maybeSource() {
-    file="$1"
-    if [ -f "$file" ] ; then
-        . $file
-    fi
-}
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+  [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
+  [ -n "$JDB_SRCPATH" ] && JDB_SRCPATH=`cygpath --unix "$JDB_SRCPATH"`
+  [ -n "$GERONIMO_HOME" ] && GERONIMO_HOME=`cygpath --unix "$GERONIMO_HOME"`
+fi
 
-detectOS() {
-    # OS specific support (must be 'true' or 'false').
-    cygwin=false;
-    darwin=false;
-    aix=false;
-    os400=false;
-    case "`uname`" in
-        CYGWIN*)
-            cygwin=true
-            ;;
-        Darwin*)
-            darwin=true
-            ;;
-        AIX*)
-            aix=true
-            ;;
-        OS400*)
-            os400=true
-            ;;
-    esac
-    # For AIX, set an environment variable
-    if $aix; then
-         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
-         export IBM_JAVA_HEAPDUMP_TEXT=true
-         echo $LDR_CNTRL
-    fi
-}
+# 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
 
-unlimitFD() {
-    # Use the maximum available, or set MAX_FD != -1 to use that
-    if [ "x$MAX_FD" = "x" ]; then
-        MAX_FD="maximum"
-    fi
+  # Enable multi threading
+  export QIBM_MULTI_THREADED=Y
+fi
 
-    # Increase the maximum file descriptors if we can
-    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
-        MAX_FD_LIMIT=`ulimit -H -n`
-        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
-            if [ $? -eq 0 ]; then
-                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-                    # use the system max
-                    MAX_FD="$MAX_FD_LIMIT"
-                fi
-
-                ulimit -n $MAX_FD > /dev/null
-                # echo "ulimit -n" `ulimit -n`
-                if [ $? -ne 0 ]; then
-                    warn "Could not set maximum file descriptor limit: $MAX_FD"
-                fi
-            else
-                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
-            fi
-        fi
-    fi
-}
+# 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="$GERONIMO_HOME"
+  . "$GERONIMO_HOME"/bin/setjavaenv.sh
+else
+  if [ -r "$GERONIMO_HOME"/bin/setjavaenv.sh ]; then
+    BASEDIR="$GERONIMO_HOME"
+    . "$GERONIMO_HOME"/bin/setjavaenv.sh
+  else
+    echo "Cannot find $GERONIMO_HOME/bin/setjavaenv.sh"
+    echo "This file is needed to run this program"
+    exit 1
+  fi
+fi
 
-locateHome() {
-    if [ "x$KARAF_HOME" != "x" ]; then
-        warn "Ignoring predefined value for KARAF_HOME"
-    fi
-    
-    # In POSIX shells, CDPATH may cause cd to write to stdout
-    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-    KARAF_HOME=`cd $DIRNAME/..; pwd`
-    if [ ! -d "$KARAF_HOME" ]; then
-        die "KARAF_HOME is not valid: $KARAF_HOME"
-    fi
-}
+# Use a default JAVA_OPTS if it's not set
+if [ -z "$JAVA_OPTS" ]; then
+  JAVA_OPTS="-Xmx256m -XX:MaxPermSize=128m"
+fi
 
-locateBase() {
-    if [ "x$KARAF_BASE" != "x" ]; then
-        if [ ! -d "$KARAF_BASE" ]; then
-            die "KARAF_BASE is not valid: $KARAF_BASE"
-        fi
-    else
-        KARAF_BASE=$KARAF_HOME
-    fi
-}
+if [ -z "$GERONIMO_TMPDIR" ] ; then
+  # Define the java.io.tmpdir to use for Geronimo
+  # A relative value will be resolved relative to each instance
+  GERONIMO_TMPDIR=var/temp
+fi
 
-setupNativePath() {
-    # Support for loading native libraries
-    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
-
-    # For Cygwin, set PATH from LD_LIBRARY_PATH
-    if $cygwin; then
-        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
-        PATH="$PATH;$LD_LIBRARY_PATH"
-        export PATH
-    fi
-    export LD_LIBRARY_PATH
-}
+if [ -z "$GERONIMO_OUT" ] ; then
+  # Define the output file we are to redirect both stdout and stderr to
+  # when Geronimo is started in the background
+  GERONIMO_OUT="$GERONIMO_HOME"/var/log/geronimo.out
+fi
 
-locateJava() {
-    # Setup the Java Virtual Machine
-    if $cygwin ; then
-        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
-        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    fi
+if [ -z "$JDB_SRCPATH" ] ; then
+  # Define the source path to be used by the JDB debugger
+  JDB_SRCPATH="$GERONIMO_HOME"/src
+fi
 
-    if [ "x$JAVA" = "x" ]; then
-        if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
-            JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-        fi
-        if [ "x$JAVA_HOME" != "x" ]; then
-            if [ ! -d "$JAVA_HOME" ]; then
-                die "JAVA_HOME is not valid: $JAVA_HOME"
-            fi
-            JAVA="$JAVA_HOME/bin/java"
-        else
-            warn "JAVA_HOME not set; results may vary"
-            JAVA="java"
-        fi
-    fi
-}
+# Classpath: Add the jars in the lib dir
+for file in $GERONIMO_HOME/lib/*.jar
+do
+  if [ -z "$CLASSPATH" ]; then
+    CLASSPATH="$file"
+  else
+    CLASSPATH="$CLASSPATH:$file"
+  fi
+done
+
+# Extension dirs
+EXT_DIRS="$GERONIMO_HOME/lib/ext:$JRE_HOME/lib/ext"
+# Endorsed dirs
+ENDORSED_DIRS="$GERONIMO_HOME/lib/endorsed:$JRE_HOME/lib/endorsed"
+
+# 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"`
+  GERONIMO_HOME=`cygpath --absolute --windows "$GERONIMO_HOME"`
+  GERONIMO_TMPDIR=`cygpath --windows "$GERONIMO_TMPDIR"`
+  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  EXT_DIRS=`cygpath --path --windows "$EXT_DIRS"`
+  ENDORSED_DIRS=`cygpath --path --windows "$ENDORSED_DIRS"`
+fi
 
-detectJVM() {
-   #echo "`$JAVA -version`"
-   # This service should call `java -version`,
-   # read stdout, and look for hints
-   if $JAVA -version 2>&1 | grep "^IBM" ; then
-       JVM_VENDOR="IBM"
-   # on OS/400, java -version does not contain IBM explicitly
-   elif $os400; then
-       JVM_VENDOR="IBM"
-   else
-       JVM_VENDOR="SUN"
-   fi
-   # echo "JVM vendor is $JVM_VENDOR"
-}
-
-setupDebugOptions() {
-    if [ "x$JAVA_OPTS" = "x" ]; then
-        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-    fi
-    export JAVA_OPTS
+# ----- Execute The Requested Command -----------------------------------------
+if [ "$GERONIMO_ENV_INFO" != "off" ] ; then
+  echo "Using GERONIMO_HOME:   $GERONIMO_HOME"
+  echo "Using GERONIMO_TMPDIR: $GERONIMO_TMPDIR"
+  if [ "$1" = "debug" ] ; then
+    echo "Using JAVA_HOME:       $JAVA_HOME"
+    echo "Using JDB_SRCPATH:     $JDB_SRCPATH"
+  else
+    echo "Using JRE_HOME:        $JRE_HOME"
+  fi
+fi
 
-    # Set Debug options if enabled
-    if [ "x$KARAF_DEBUG" != "x" ]; then
-        # Use the defaults if JAVA_DEBUG_OPTS was not set
-        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
-            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
-        fi
+LONG_OPT=
+if [ "$1" = "start" ] ; then
+  LONG_OPT=--long
+  if [ "$GERONIMO_ENV_INFO" != "off" ] ; then
+    echo "Using GERONIMO_OUT:    $GERONIMO_OUT"
+  fi
+fi
 
-        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
-        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
-    fi
-}
+if [ "$1" = "jpda" ] ; then
+  if [ -z "$JPDA_SUSPEND" ]; then
+    JPDA_SUSPEND="n"
+  fi
+  if [ -z "$JPDA_TRANSPORT" ]; then
+    JPDA_TRANSPORT="dt_socket"
+  fi
+  if [ -z "$JPDA_ADDRESS" ]; then
+    JPDA_ADDRESS="8000"
+  fi
+  if [ -z "$JPDA_OPTS" ]; then
+    JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
+  fi
+  if [ "$GERONIMO_ENV_INFO" != "off" ] ; then
+    echo "Using JPDA_OPTS:       $JPDA_OPTS"
+  fi
+  GERONIMO_OPTS="$GERONIMO_OPTS $JPDA_OPTS"
+  shift
+fi
 
-setupDefaults() {
-    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM "
+# Setup the Java programming language agent
+JAVA_AGENT_JAR="$GERONIMO_HOME/bin/jpa.jar"
 
-    #Set the JVM_VENDOR specific JVM flags
-    if [ "$JVM_VENDOR" = "SUN" ]; then
-        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
-    elif [ "$JVM_VENDOR" = "IBM" ]; then
-        if $os400; then
-            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-        elif $aix; then
-            DEFAULT_JAVA_OPTS="-Xverify:none -Xlp $DEFAULT_JAVA_OPTS"
-        else
-            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
-        fi
-    fi
+if [ "$1" = "debug" ] ; then
+  if $os400; then
+    echo "Debug command not available on OS400"
+    exit 1
+  else
+    echo "Note: The jdb debugger will start Geronimo in another process and connect to it."
+    echo "      To terminate Geronimo when running under jdb, run the "geronimo stop" command"
+    echo "      in another window.  Do not use Ctrl-C as that will terminate the jdb client"
+    echo "      (the debugger itself) but will not stop the Geronimo process."
+    shift
+    exec "$_RUNJDB" $JAVA_OPTS $GERONIMO_OPTS \
+      -sourcepath "$JDB_SRCPATH" \
+      -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true \
+      -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+      -Dkaraf.home="$GERONIMO_HOME" \
+      -Dkaraf.base="$GERONIMO_HOME" \
+      -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+      -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+      -Djava.ext.dirs="$EXT_DIRS" \
+      -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+      -classpath "$CLASSPATH" \
+       org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
+  fi
+
+elif [ "$1" = "run" ]; then
+  shift
+  if [ -f "$JAVA_AGENT_JAR" ]; then
+      exec "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+        -javaagent:"$JAVA_AGENT_JAR" \
+        -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false \
+        -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+        -Dkaraf.home="$GERONIMO_HOME" \
+        -Dkaraf.base="$GERONIMO_HOME" \
+        -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+        -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+        -Djava.ext.dirs="$EXT_DIRS" \
+        -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+        -classpath "$CLASSPATH" \
+        org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
+  else
+      exec "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+        -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false \
+        -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+        -Dkaraf.home="$GERONIMO_HOME" \
+        -Dkaraf.base="$GERONIMO_HOME" \
+        -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+        -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+        -Djava.ext.dirs="$EXT_DIRS" \
+        -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+        -classpath "$CLASSPATH" \
+        org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@"
+  fi
 
-    # Add the jars in the lib dir
-    for file in $KARAF_HOME/lib/*.jar
-    do
-        if [ -z "$CLASSPATH" ]; then
-            CLASSPATH="$file"
-        else
-            CLASSPATH="$CLASSPATH:$file"
+elif [ "$1" = "start" ] ; then
+  shift
+  touch "$GERONIMO_OUT"
+  if [ -f "$JAVA_AGENT_JAR" ]; then
+      $START_OS_CMD "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+        -javaagent:"$JAVA_AGENT_JAR" \
+        -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true \
+        -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+        -Dkaraf.home="$GERONIMO_HOME" \
+        -Dkaraf.base="$GERONIMO_HOME" \
+        -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+        -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+        -Djava.ext.dirs="$EXT_DIRS" \
+        -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+        -classpath "$CLASSPATH" \
+        org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@" \
+        >> $GERONIMO_OUT 2>&1 &
+        echo ""
+        echo "Geronimo started in background. PID: $!"
+        if [ ! -z "$GERONIMO_PID" ]; then
+          echo $! > $GERONIMO_PID
         fi
-    done
-
-    EXT_DIRS="$KARAF_HOME/lib/ext:$JAVA_HOME/lib/ext"
-    ENDORSED_DIRS="$KARAF_HOME/lib/endorsed:$JAVA_HOME/lib/endorsed"
-
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
-    ##
-    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
-    ##
-    # Uncomment to enable YourKit profiling
-    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
-}
-
-init() {
-    # Determine if there is special OS handling we must perform
-    detectOS
-
-    # Unlimit the number of file descriptors if possible
-    unlimitFD
-
-    # Locate the Karaf home directory
-    locateHome
-
-    # Locate the Karaf base directory
-    locateBase
-
-    # Setup the native library path
-    setupNativePath
-
-    # Locate the Java VM to execute
-    locateJava
-
-    # Determine the JVM vendor
-    detectJVM
-
-    # Setup default options
-    setupDefaults
-
-    # Install debug options
-    setupDebugOptions
-
-}
-
-run() {
-    OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true"
-    case "$1" in
-        'console')
-            shift
-            ;;
-        'server')
-            OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-            shift
-            ;;
-        'client')
-            OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false"
-            shift
-            ;;
-    esac
-
-    if $cygwin; then
-        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
-        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
-        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-        EXT_DIRS=`cygpath --path --windows "$EXT_DIRS"`
-        ENDORSED_DIRS=`cygpath --path --windows "$ENDORSED_DIRS"`
-    fi
-    exec $JAVA $JAVA_OPTS \
-        -Dorg.apache.geronimo.home.dir="$KARAF_HOME" \
-        -Dkaraf.home="$KARAF_HOME" \
-        -Dkaraf.base="$KARAF_BASE" \
-        -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties \
+  else
+      $START_OS_CMD "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+        -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true \
+        -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+        -Dkaraf.home="$GERONIMO_HOME" \
+        -Dkaraf.base="$GERONIMO_HOME" \
+        -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
         -Djava.endorsed.dirs="$ENDORSED_DIRS" \
         -Djava.ext.dirs="$EXT_DIRS" \
-        $OPTS \
+        -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
         -classpath "$CLASSPATH" \
-        org.apache.geronimo.cli.daemon.DaemonCLI \
-        "$@"
-}
-
-main() {
-    init
-    run "$@"
-}
+        org.apache.geronimo.cli.daemon.DaemonCLI $LONG_OPT "$@" \
+        >> $GERONIMO_OUT 2>&1 &
+        echo ""
+        echo "Geronimo started in background. PID: $!"
+        if [ ! -z "$GERONIMO_PID" ]; then
+          echo $! > $GERONIMO_PID
+        fi
+  fi
 
-main "$@"
+elif [ "$1" = "stop" ] ; then
+  shift
+  FORCE=0
+# support -force as that is the option Tomcat uses, we will document
+# --force as the option to be consistent with other Geronimo options.
+  if [ "$1" = "--force" -o "$1" = "-force" ]; then
+    shift
+    FORCE=1
+  fi
+
+  "$_RUNJAVA" $JAVA_OPTS $GERONIMO_OPTS \
+    -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=false \
+    -Dorg.apache.geronimo.home.dir="$GERONIMO_HOME" \
+    -Dkaraf.home="$GERONIMO_HOME" \
+    -Dkaraf.base="$GERONIMO_HOME" \
+    -Djava.util.logging.config.file=$GERONIMO_HOME/etc/java.util.logging.properties \
+    -Djava.endorsed.dirs="$ENDORSED_DIRS" \
+    -Djava.ext.dirs="$EXT_DIRS" \
+    -Djava.io.tmpdir="$GERONIMO_TMPDIR" \
+    -classpath "$CLASSPATH" \
+    org.apache.geronimo.cli.shutdown.ShutdownCLI "$@"
+
+  if [ $FORCE -eq 1 ]; then
+    if [ ! -z "$GERONIMO_PID" ]; then
+       echo "Killing: `cat $GERONIMO_PID`"
+       kill -9 `cat $GERONIMO_PID`
+    fi
+  fi
+
+else
+
+  echo "Usage: geronimo command [geronimo_args]"
+  echo "commands:"
+  echo "  debug             Debug Geronimo in jdb debugger"
+  echo "  jpda run          Start Geronimo in foreground under JPDA debugger"
+  echo "  jpda start        Start Geronimo in background under JPDA debugger"
+  echo "  run               Start Geronimo in the foreground"
+  echo "  start             Start Geronimo in the background"
+  echo "  stop              Stop Geronimo"
+  echo "  stop --force      Stop Geronimo (followed by kill -KILL)"
+  echo ""
+  echo "args for debug, jpda run, jpda start, run and start commands:"
+  echo "       --quiet       No startup progress"
+  echo "       --long        Long startup progress"
+  echo "  -v   --verbose     INFO log level"
+  echo "  -vv  --veryverbose DEBUG log level"
+  echo "       --override    Override configurations. USE WITH CAUTION!"
+  echo "       --help        Detailed help."
+  echo ""
+  echo "args for stop command:"
+  echo "       --user        Admin user"
+  echo "       --password    Admin password"
+  echo "       --host        Hostname of the server"
+  echo "       --port        RMI port to connect to"
+  echo "       --secure      Enable secure JMX communication"
+  exit 1
+
+fi

Added: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh?rev=935712&view=auto
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh (added)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh Mon Apr 19 19:41:37 2010
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev$ $Date$
+# --------------------------------------------------------------------
+
+# --------------------------------------------------------------------
+# Set environment variables relating to the execution of java commands.
+#
+# This script file is called by the geronimo.sh file (which is invoked
+# by the startup.sh, shutdown.sh files).  This file is also invoked
+# by the deploy.sh file.
+#
+# It is preferable (to simplify migration to future Geronimo releases)
+# to set any environment variables you need in the setenv.sh file
+# rather than modifying Geronimo's script files.  See the documentation
+# in the geronimo.sh file for further information.
+#
+# (Based upon Apache Tomcat 5.5.12's setclasspath.sh)
+#
+# --------------------------------------------------------------------
+
+# Make sure prerequisite environment variables are set
+if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
+  __JAVA_TEST="which java"
+  if [ -n "__JAVA_TEST" ]; then
+    _RUNJAVA="java"
+  else
+    echo ""
+    echo "ERROR:  Could not find a Java runtime."
+    echo " - Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo " - A Java implementation could not be found on the system PATH"
+    echo "At least one of these is required for this program to execute."
+    echo ""
+    exit 1
+  fi
+else
+
+if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
+  echo "JAVA_HOME should point to a JDK in order to run in debug mode."
+  exit 1
+fi
+if [ -z "$JRE_HOME" ]; then
+   if [ -d "$JAVA_HOME/jre" ]; then
+     JRE_HOME="$JAVA_HOME/jre"
+   else
+     JRE_HOME="$JAVA_HOME"
+   fi
+fi
+
+# If we're running under jdb, we need a full jdk.
+if [ "$1" = "debug" ] ; then
+  if [ "$os400" = "true" ]; then
+    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
+      echo "The JAVA_HOME environment variable is not defined correctly"
+      echo "This environment variable is needed to run this program"
+      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      exit 1
+    fi
+  else
+    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
+      echo "The JAVA_HOME environment variable is not defined correctly"
+      echo "This environment variable is needed to run this program"
+      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      exit 1
+    fi
+  fi
+fi
+if [ -z "$BASEDIR" ]; then
+  echo "The BASEDIR environment variable is not defined"
+  echo "This environment variable is needed to run this program"
+  exit 1
+fi
+if [ ! -x "$BASEDIR"/bin/setjavaenv.sh ]; then
+  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
+    echo "The BASEDIR environment variable is not defined correctly"
+    echo "This environment variable is needed to run this program"
+    exit 1
+  fi
+fi
+
+# Set standard commands for invoking Java.
+  _RUNJAVA="$JRE_HOME"/bin/java
+if [ "$os400" != "true" ]; then
+  _RUNJDB="$JAVA_HOME"/bin/jdb
+fi
+fi

Propchange: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/setjavaenv.sh
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown?rev=935712&r1=935711&r2=935712&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/shutdown Mon Apr 19 19:41:37 2010
@@ -1,296 +1,72 @@
 #!/bin/sh
 #
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-# $Id: karaf 979 2005-11-30 22:50:55Z bsnyder $
-#
-
-DIRNAME=`dirname $0`
-PROGNAME=`basename $0`
-
-#
-# Check/Set up some easily accessible MIN/MAX params for JVM mem usage
-#
-
-if [ "x$JAVA_MIN_MEM" = "x" ]; then
-    JAVA_MIN_MEM=128M
-    export JAVA_MIN_MEM
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev: 708650 $ $Date: 2008-10-28 15:48:22 -0400 (Tue, 28 Oct 2008) $
+# --------------------------------------------------------------------
+
+# --------------------------------------------------------------------
+# Shutdown script file for Geronimo.
+#
+# This script calls the geronimo.sh script passing "stop" as the
+# first argument followed by the arguments supplied by the caller.
+#
+# This script is based upon Tomcat's shutdown file to enable
+# those familiar with Tomcat to easily stop Geronimo.
+# 
+# Alternatively you can use the more comprehensive geronimo.sh file 
+# directly.
+#
+# Invocation Syntax:
+#
+#   shutdown [geronimo stop command args] 
+#
+#   Invoke the shutdown file without any arguments for information
+#   on arguments for the geronimo.sh stop command that is invoked
+#   by this script.
+#
+# Environment Variable Prequisites:
+#
+#   Refer to the documentation in the geronimo.sh file for information
+#   on environment variables etc.
+#
+# --------------------------------------------------------------------
+
+# 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=geronimo
+
+# Check that target executable exists
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+  echo "Cannot find $PRGDIR/$EXECUTABLE"
+  echo "This file is needed to run this program"
+  exit 1
 fi
 
-if [ "x$JAVA_MAX_MEM" = "x" ]; then
-    JAVA_MAX_MEM=512M
-    export JAVA_MAX_MEM
-fi
-
-warn() {
-    echo "${PROGNAME}: $*"
-}
-
-die() {
-    warn "$*"
-    exit 1
-}
-
-maybeSource() {
-    file="$1"
-    if [ -f "$file" ] ; then
-        . $file
-    fi
-}
-
-detectOS() {
-    # OS specific support (must be 'true' or 'false').
-    cygwin=false;
-    darwin=false;
-    aix=false;
-    os400=false;
-    case "`uname`" in
-        CYGWIN*)
-            cygwin=true
-            ;;
-        Darwin*)
-            darwin=true
-            ;;
-        AIX*)
-            aix=true
-            ;;
-        OS400*)
-            os400=true
-            ;;
-    esac
-    # For AIX, set an environment variable
-    if $aix; then
-         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
-         export IBM_JAVA_HEAPDUMP_TEXT=true
-         echo $LDR_CNTRL
-    fi
-}
-
-unlimitFD() {
-    # Use the maximum available, or set MAX_FD != -1 to use that
-    if [ "x$MAX_FD" = "x" ]; then
-        MAX_FD="maximum"
-    fi
-
-    # Increase the maximum file descriptors if we can
-    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
-        MAX_FD_LIMIT=`ulimit -H -n`
-        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
-            if [ $? -eq 0 ]; then
-                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
-                    # use the system max
-                    MAX_FD="$MAX_FD_LIMIT"
-                fi
-
-                ulimit -n $MAX_FD > /dev/null
-                # echo "ulimit -n" `ulimit -n`
-                if [ $? -ne 0 ]; then
-                    warn "Could not set maximum file descriptor limit: $MAX_FD"
-                fi
-            else
-                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
-            fi
-        fi
-    fi
-}
-
-locateHome() {
-    if [ "x$KARAF_HOME" != "x" ]; then
-        warn "Ignoring predefined value for KARAF_HOME"
-    fi
-    
-    # In POSIX shells, CDPATH may cause cd to write to stdout
-    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-    KARAF_HOME=`cd $DIRNAME/..; pwd`
-    if [ ! -d "$KARAF_HOME" ]; then
-        die "KARAF_HOME is not valid: $KARAF_HOME"
-    fi
-}
-
-locateBase() {
-    if [ "x$KARAF_BASE" != "x" ]; then
-        if [ ! -d "$KARAF_BASE" ]; then
-            die "KARAF_BASE is not valid: $KARAF_BASE"
-        fi
-    else
-        KARAF_BASE=$KARAF_HOME
-    fi
-}
-
-setupNativePath() {
-    # Support for loading native libraries
-    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
-
-    # For Cygwin, set PATH from LD_LIBRARY_PATH
-    if $cygwin; then
-        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
-        PATH="$PATH;$LD_LIBRARY_PATH"
-        export PATH
-    fi
-    export LD_LIBRARY_PATH
-}
-
-locateJava() {
-    # Setup the Java Virtual Machine
-    if $cygwin ; then
-        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
-        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    fi
-
-    if [ "x$JAVA" = "x" ]; then
-        if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
-            JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-        fi
-        if [ "x$JAVA_HOME" != "x" ]; then
-            if [ ! -d "$JAVA_HOME" ]; then
-                die "JAVA_HOME is not valid: $JAVA_HOME"
-            fi
-            JAVA="$JAVA_HOME/bin/java"
-        else
-            warn "JAVA_HOME not set; results may vary"
-            JAVA="java"
-        fi
-    fi
-}
-
-detectJVM() {
-   #echo "`$JAVA -version`"
-   # This service should call `java -version`,
-   # read stdout, and look for hints
-   if $JAVA -version 2>&1 | grep "^IBM" ; then
-       JVM_VENDOR="IBM"
-   # on OS/400, java -version does not contain IBM explicitly
-   elif $os400; then
-       JVM_VENDOR="IBM"
-   else
-       JVM_VENDOR="SUN"
-   fi
-   # echo "JVM vendor is $JVM_VENDOR"
-}
-
-setupDebugOptions() {
-    if [ "x$JAVA_OPTS" = "x" ]; then
-        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-    fi
-    export JAVA_OPTS
-
-    # Set Debug options if enabled
-    if [ "x$KARAF_DEBUG" != "x" ]; then
-        # Use the defaults if JAVA_DEBUG_OPTS was not set
-        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
-            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
-        fi
-
-        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
-        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
-    fi
-}
-
-setupDefaults() {
-    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM "
-
-    #Set the JVM_VENDOR specific JVM flags
-    if [ "$JVM_VENDOR" = "SUN" ]; then
-        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
-    elif [ "$JVM_VENDOR" = "IBM" ]; then
-        if $os400; then
-            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
-        elif $aix; then
-            DEFAULT_JAVA_OPTS="-Xverify:none -Xlp $DEFAULT_JAVA_OPTS"
-        else
-            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
-        fi
-    fi
-
-    # Add the jars in the lib dir
-    for file in $KARAF_HOME/lib/*.jar
-    do
-        if [ -z "$CLASSPATH" ]; then
-            CLASSPATH="$file"
-        else
-            CLASSPATH="$CLASSPATH:$file"
-        fi
-    done
-    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
-    ##
-    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
-    ##
-    # Uncomment to enable YourKit profiling
-    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
-}
-
-init() {
-    # Determine if there is special OS handling we must perform
-    detectOS
-
-    # Unlimit the number of file descriptors if possible
-    unlimitFD
-
-    # Locate the Karaf home directory
-    locateHome
-
-    # Locate the Karaf base directory
-    locateBase
-
-    # Setup the native library path
-    setupNativePath
-
-    # Locate the Java VM to execute
-    locateJava
-
-    # Determine the JVM vendor
-    detectJVM
-
-    # Setup default options
-    setupDefaults
-
-    # Install debug options
-    setupDebugOptions
-
-}
-
-run() {
-    OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-    case "$1" in
-        'console')
-            shift
-            ;;
-        'server')
-            OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
-            shift
-            ;;
-        'client')
-            OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false"
-            shift
-            ;;
-    esac
-
-    if $cygwin; then
-        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
-        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
-        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-    fi
-    exec $JAVA $JAVA_OPTS -Dorg.apache.geronimo.home.dir="$KARAF_HOME" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties $OPTS -classpath "$CLASSPATH" org.apache.geronimo.cli.shutdown.ShutdownCLI "$@"
-}
-
-main() {
-    init
-    run "$@"
-}
-
-main "$@"
+exec "$PRGDIR"/"$EXECUTABLE" stop "$@"

Added: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup?rev=935712&view=auto
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup (added)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup Mon Apr 19 19:41:37 2010
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# --------------------------------------------------------------------
+# $Rev: 708650 $ $Date: 2008-10-28 15:48:22 -0400 (Tue, 28 Oct 2008) $
+# --------------------------------------------------------------------
+
+# --------------------------------------------------------------------
+# Startup script file for Geronimo that starts Geronimo in the background.
+#
+# This script calls the geronimo.sh script passing "start" as the
+# first argument followed by the arguments supplied by the caller.
+#
+# This script is based upon Tomcat's startup file to enable
+# those familiar with Tomcat to quickly get started with Geronimo.
+# 
+# Alternatively you can use the more comprehensive geronimo.sh file 
+# directly.
+#
+# Invocation Syntax:
+#
+#   startup [geronimo_args ...]
+#
+# Environment Variable Prequisites:
+#
+#   Refer to the documentation in the geronimo.sh 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=geronimo
+
+# 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 
+
+exec "$PRGDIR"/"$EXECUTABLE" start "$@"

Propchange: geronimo/server/trunk/framework/configs/karaf-framework/src/main/distribution/unix-shell/bin/startup
------------------------------------------------------------------------------
    svn:executable = *