You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/03/27 12:22:11 UTC

cvs commit: jakarta-avalon-phoenix/src/script run.bat run.sh

donaldp     02/03/27 03:22:10

  Modified:    src/script run.bat run.sh
  Log:
  Update scripts so that they are location independent. ie you should be ablke to run the scripts regardless of your current working directory.
  
  Also made the abil;ity to overide java.io.tmp directory and defaulted it to $PHOENIX_HOME/temp
  
  The unix script seems to work but the windows one has yet to be tested.
  
  Revision  Changes    Path
  1.5       +28 -5     jakarta-avalon-phoenix/src/script/run.bat
  
  Index: run.bat
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/script/run.bat,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- run.bat	15 Jul 2001 03:02:24 -0000	1.4
  +++ run.bat	27 Mar 2002 11:22:10 -0000	1.5
  @@ -4,11 +4,21 @@
   rem
   rem Author: Peter Donald [donaldp@apache.org]
   rem
  -rem The user may choose to supply parameters to the JVM (such as memory settings)
  -rem via setting the environment variable PHOENIX_JVM_OPTS
  +rem Environment Variable Prequisites
   rem
  -rem The user may also disable the security manager by setting PHOENIX_SECURE=false
  +rem   PHOENIX_OPTS       (Optional) Java runtime options used when the command is 
  +rem                      executed.
   rem
  +rem   PHOENIX_TMPDIR     (Optional) Directory path location of temporary directory
  +rem                      the JVM should use (java.io.tmpdir).  Defaults to
  +rem                      $CATALINA_BASE/temp.
  +rem
  +rem   JAVA_HOME          Must point at your Java Development Kit installation.
  +rem
  +rem   PHOENIX_JVM_OPTS   (Optional) Java runtime options used when the command is 
  +rem                       executed.
  +rem
  +rem -----------------------------------------------------------------------------
   
   rem
   rem Determine if JAVA_HOME is set and if so then use it
  @@ -47,8 +57,21 @@
   
   :phoenix_home
   
  -rem echo "Home directory: %PHOENIX_HOME%"
  -rem echo "Home ext directory: %PHOENIX_HOME%\lib"
  +if [ -z "$PHOENIX_TMPDIR" ] ; then
  +  # Define the java.io.tmpdir to use for Phoenix
  +  PHOENIX_TMPDIR="$PHOENIX_HOME"/temp
  +  mkdir -p "$PHOENIX_TMPDIR"
  +fi
  +
  +if not "%PHOENIX_TMPDIR%"=="" goto afterTmpDir
  +set PHOENIX_TMPDIR=%PHOENIX_HOME%\temp
  +if not exist "%PHOENIX_TMPDIR%" mkdir %PHOENIX_TMPDIR%
  +
  +:afterTmpDir
  +
  +echo "Using PHOENIX_HOME:   %PHOENIX_HOME%"
  +echo "Using PHOENIX_TMPDIR: %PHOENIX_TMPDIR%"
  +echo "Using JAVA_HOME:      %JAVA_HOME%"
   
   set PHOENIX_SM=
   
  
  
  
  1.7       +61 -23    jakarta-avalon-phoenix/src/script/run.sh
  
  Index: run.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/script/run.sh,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- run.sh	22 Mar 2002 20:03:06 -0000	1.6
  +++ run.sh	27 Mar 2002 11:22:10 -0000	1.7
  @@ -1,14 +1,31 @@
   #! /bin/sh
   #
  +# -----------------------------------------------------------------------------
   # Phoenix start script.
   #
   # Author: Peter Donald <pe...@apache.org>
  +
  +# Environment Variable Prequisites
  +#
  +#   PHOENIX_OPTS       (Optional) Java runtime options used when the command is 
  +#                      executed.
   #
  -# The user may choose to supply parameters to the JVM (such as memory settings)
  -# via setting the environment variable PHOENIX_JVM_OPTS.
  +#   PHOENIX_TMPDIR     (Optional) Directory path location of temporary directory
  +#                      the JVM should use (java.io.tmpdir).  Defaults to
  +#                      $CATALINA_BASE/temp.
   #
  -# The user may also disable the security manager by setting PHOENIX_SECURE=false
  +#   JAVA_HOME          Must point at your Java Development Kit installation.
   #
  +#   PHOENIX_JVM_OPTS   (Optional) Java runtime options used when the command is 
  +#                       executed.
  +#
  +# -----------------------------------------------------------------------------
  +
  +# OS specific support.  $var _must_ be set to either true or false.
  +cygwin=false
  +case "`uname`" in
  +CYGWIN*) cygwin=true;;
  +esac
   
   # Checking for JAVA_HOME is required on *nix due
   # to some distributions stupidly including kaffe in /usr/bin
  @@ -20,28 +37,46 @@
     exit 1
   fi
   
  -#
  -# Locate where phoenix is in filesystem
  -#
  -THIS_PROG=`dirname $0`
  -
  -if [ "$THIS_PROG" = "." ] ; then
  -  THIS_PROG=$PWD
  +# resolve links - $0 may be a softlink
  +THIS_PROG="$0"
   
  -  ## convert cygwin path so Java will recognize it
  -  if [ $OSTYPE = "cygwin32" ] || [ $OSTYPE = "cygwin" ] ; then
  -    THIS_PROG=`cygpath -p -w $THIS_PROG`
  +while [ -h "$THIS_PROG" ]; do
  +  ls=`ls -ld "$THIS_PROG"`
  +  link=`expr "$ls" : '.*-> \(.*\)$'`
  +  if expr "$link" : '.*/.*' > /dev/null; then
  +    THIS_PROG="$link"
  +  else
  +    THIS_PROG=`dirname "$THIS_PROG"`/"$link"
     fi
  +done
  +
  +# Get standard environment variables
  +PRGDIR=`dirname "$THIS_PROG"`
  +PHOENIX_HOME=`cd "$PRGDIR/.." ; pwd`
  +
  +unset THIS_PROG
  +
  +# For Cygwin, ensure paths are in UNIX format before anything is touched
  +if $cygwin; then
  +  [ -n "$PHOENIX_HOME" ] && PHOENIX_HOME=`cygpath --unix "$PHOENIX_HOME"`
   fi
   
  -if [ "$PHOENIX_HOME" = "" ] ; then
  -  PHOENIX_HOME=$THIS_PROG/..
  +if [ -z "$PHOENIX_TMPDIR" ] ; then
  +  # Define the java.io.tmpdir to use for Phoenix
  +  PHOENIX_TMPDIR="$PHOENIX_HOME"/temp
  +  mkdir -p "$PHOENIX_TMPDIR"
   fi
   
  -unset THIS_PROG
  +# For Cygwin, switch paths to Windows format before running java
  +if $cygwin; then
  +  PHOENIX_HOME=`cygpath --path --windows "$PHOENIX_HOME"`
  +fi
  +
  +# ----- Execute The Requested Command -----------------------------------------
   
  -# echo "Home directory: $PHOENIX_HOME"
  -# echo "Home ext directory: $PHOENIX_HOME/lib"
  +echo "Using PHOENIX_HOME:   $PHOENIX_HOME"
  +echo "Using PHOENIX_TMPDIR: $PHOENIX_TMPDIR"
  +echo "Using JAVA_HOME:      $JAVA_HOME"
   
   #
   # Command to overide JVM ext dir
  @@ -50,10 +85,7 @@
   # like placing jaxp/jaas/xml-parser jars in ext dir
   # thus breaking Phoenix
   #
  -PROPS="-Djava.ext.dirs=$PHOENIX_HOME/lib -Dphoenix.home=$PHOENIX_HOME"
  -LOADER_JAR="$PHOENIX_HOME/bin/phoenix-loader.jar"
  -POLICY="-Djava.security.policy=jar:file:$LOADER_JAR!/META-INF/java.policy"
  -JVM_OPTS="$PROPS $POLICY $PHOENIX_JVM_OPTS"
  +JVM_OPTS="-Djava.ext.dirs=$PHOENIX_HOME/lib"
   
   if [ "$PHOENIX_SECURE" != "false" ] ; then
     # Make phoenix run with security manager enabled
  @@ -61,4 +93,10 @@
   fi
   
   # Kicking the tires and lighting the fires!!!
  -$JAVA_HOME/bin/java $JVM_OPTS -jar $LOADER_JAR $*
  +$JAVA_HOME/bin/java $JVM_OPTS \
  +    $JVM_OPTS \
  +    -Djava.security.policy=jar:file:$PHOENIX_HOME/bin/phoenix-loader.jar!/META-INF/java.policy \
  +    $PHOENIX_JVM_OPTS \
  +    -Dphoenix.home="$PHOENIX_HOME" \
  +    -Djava.io.tmpdir="$PHOENIX_TMPDIR" \
  +    -jar "$PHOENIX_HOME/bin/phoenix-loader.jar" $*
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>