You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/06/10 05:14:48 UTC

cvs commit: avalon-sandbox/merlin/merlin-platform/src/bin InstallService-NT.bat UninstallService-NT.bat Wrapper.exe merlin.bat merlin.sh run.sh

mcconnell    2003/06/09 20:14:48

  Added:       merlin/merlin-platform/src/bin InstallService-NT.bat
                        UninstallService-NT.bat Wrapper.exe merlin.bat
                        merlin.sh run.sh
  Log:
  addition of bin resources
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/InstallService-NT.bat
  
  Index: InstallService-NT.bat
  ===================================================================
  @echo off
  rem
  rem Find the application home.
  rem
  if "%OS%"=="Windows_NT" goto nt
  
  echo This is not NT, so please edit this script and set _APP_HOME manually
  set _APP_HOME=..
  
  goto conf
  
  :nt
  rem %~dp0 is name of current script under NT
  set _APP_HOME=%~dp0
  rem : operator works similar to make : operator
  set _APP_HOME=%_APP_HOME:\bin\=%
  
  
  rem
  rem Find the wrapper.conf
  rem
  :conf
  set _WRAPPER_CONF="%~f1"
  if not %_WRAPPER_CONF%=="" goto startup
  set _WRAPPER_CONF="%_APP_HOME%\config\wrapper.conf"
  
  
  rem
  rem Run the application.
  rem At runtime, the current directory will be that of Wrapper.exe
  rem
  :startup
  "%_APP_HOME%\bin\Wrapper.exe" -i %_WRAPPER_CONF%
  if not errorlevel 1 goto end
  pause
  
  :end
  set _APP_HOME=
  set _WRAPPER_CONF=
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/UninstallService-NT.bat
  
  Index: UninstallService-NT.bat
  ===================================================================
  @echo off
  rem
  rem Find the application home.
  rem
  if "%OS%"=="Windows_NT" goto nt
  
  echo This is not NT, so please edit this script and set _APP_HOME manually
  set _APP_HOME=..
  
  goto conf
  
  :nt
  rem %~dp0 is name of current script under NT
  set _APP_HOME=%~dp0
  rem : operator works similar to make : operator
  set _APP_HOME=%_APP_HOME:\bin\=%
  
  
  rem
  rem Find the wrapper.conf
  rem
  :conf
  set _WRAPPER_CONF="%~f1"
  if not %_WRAPPER_CONF%=="" goto startup
  set _WRAPPER_CONF="%_APP_HOME%\config\wrapper.conf"
  
  
  rem
  rem Run the application.
  rem At runtime, the current directory will be that of Wrapper.exe
  rem
  :startup
  "%_APP_HOME%\bin\Wrapper.exe" -r %_WRAPPER_CONF%
  if not errorlevel 1 goto end
  pause
  
  :end
  set _APP_HOME=
  set _WRAPPER_CONF=
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/Wrapper.exe
  
  	<<Binary file>>
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/merlin.bat
  
  Index: merlin.bat
  ===================================================================
  @echo off
  java -jar %MERLIN_HOME%\lib\system\merlin-cli-1.0.jar -system %MERLIN_HOME% %1 %2 %3 %4 %5 %6
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/merlin.sh
  
  Index: merlin.sh
  ===================================================================
  #! /bin/sh
  #
  # -----------------------------------------------------------------------------
  # Merlin start script. Based on the Avalon-Phoenix start script.
  #
  # Author: Alexis Agahi <al...@users.sourceforge.net>
  #         Peter Donald <peter at apache.org>
  #         Leo Simons <leosimons at apache.org>
  #
  # Environment Variable Prequisites
  #
  #   MERLIN_OPTS       (Optional) Java runtime options used when the command is
  #                      executed.
  #
  #   JAVA_HOME          Must point at your Java Development Kit installation.
  #
  #   MERLIN_JVM_OPTS   (Optional) Java runtime options used when the command is
  #                       executed.
  #
  # -----------------------------------------------------------------------------
  
  usage()
  {
      echo "Usage: $0 {start|stop|run|restart|check}"
      exit 1
  }
  
  [ $# -gt 0 ] || usage
  
  ##################################################
  # Get the action & configs
  ##################################################
  
  ACTION=$1
  shift
  ARGS="$*"
  
  
  
  # OS specific support.  $var _must_ be set to either true or false.
  cygwin=false
  case "`uname`" in
  CYGWIN*) cygwin=true;;
  esac
  
  # resolve links - $0 may be a softlink
  THIS_PROG="$0"
  
  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"`
  MERLIN_HOME=`cd "$PRGDIR/.." ; pwd`
  
  unset THIS_PROG
  
  if [ -r "$MERLIN_HOME"/bin/setenv.sh ]; then
    . "$MERLIN_HOME"/bin/setenv.sh
  fi
  
  # Checking for JAVA_HOME is required on *nix due
  # to some distributions stupidly including kaffe in /usr/bin
  if [ "$JAVA_HOME" = "" ] ; then
    echo "ERROR: JAVA_HOME not found in your environment."
    echo
    echo "Please, set the JAVA_HOME variable in your environment to match the"
    echo "location of the Java Virtual Machine you want to use."
    exit 1
  fi
  
  # For Cygwin, ensure paths are in UNIX format before anything is touched
  if $cygwin; then
    [ -n "$MERLIN_HOME" ] && MERLIN_HOME=`cygpath --unix "$MERLIN_HOME"`
  fi
  
  # For Cygwin, switch paths to Windows format before running java
  if $cygwin; then
    MERLIN_HOME=`cygpath --path --windows "$MERLIN_HOME"`
  fi
  
  # ----- Execute The Requested Command -----------------------------------------
  
  
  # Uncomment to get enable remote debugging
  # DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
  #
  # Command to overide JVM ext dir
  #
  # This is needed as some JVM vendors do foolish things
  # like placing jaxp/jaas/xml-parser jars in ext dir
  # thus breaking Merlin
  #
  JVM_EXT_DIRS="$MERLIN_HOME/lib/shared:$MERLIN_HOME/lib/system"
  if $cygwin; then
    JVM_EXT_DIRS=`cygpath --path --windows "$JVM_EXT_DIRS"`
  fi
  JVM_OPTS="-Djava.ext.dirs=$JVM_EXT_DIRS"
  
  # Get the run cmd
  RUN_CMD="$JAVA_HOME/bin/java $JVM_OPTS \
      $DEBUG \
      $MERLIN_JVM_OPTS \
      -jar "$MERLIN_HOME/lib/system/merlin-cli-1.0.jar" \
      -system "$MERLIN_HOME" \
      $*"
  
  echo "Using MERLIN_HOME:   $MERLIN_HOME"
  echo "Using JAVA_HOME:     $JAVA_HOME"
  echo "USing RUN_CMD:       $RUN_CMD"
  
  #####################################################
  # Find a PID for the pid file
  #####################################################
  if [  -z "$MERLIN_PID" ]
  then
    MERLIN_PID="$MERLIN_TMPDIR/merlin.pid"
  fi
  
  #####################################################
  # Find a location for the merlin console
  #####################################################
  MERLIN_CONSOLE="$MERLIN_TMPDIR/merlin.console"
  if [  -z "$MERLIN_CONSOLE" ]
  then
    if [ -w /dev/console ]
    then
      MERLIN_CONSOLE=/dev/console
    else
      MERLIN_CONSOLE=/dev/tty
    fi
  fi
  
  
  #####################################################
  # Action!
  #####################################################
  
  case "$ACTION" in
    start)
          echo "Starting Merlin: "
  
          if [ -f $MERLIN_PID ]
          then
              echo "Already Running!!"
              exit 1
          fi
  
          echo "STARTED Merlin `date`" >> $MERLIN_CONSOLE
  
          nohup sh -c "exec $RUN_CMD >>$MERLIN_CONSOLE 2>&1" >/dev/null &
          echo $! > $MERLIN_PID
          echo "Merlin running pid="`cat $MERLIN_PID`
          ;;
  
    stop)
          PID=`cat $MERLIN_PID 2>/dev/null`
          echo "Shutting down Merlin: $PID"
          kill $PID 2>/dev/null
          sleep 2
          kill -9 $PID 2>/dev/null
          rm -f $MERLIN_PID
          echo "STOPPED `date`" >>$MERLIN_CONSOLE
          ;;
  
    restart)
          $0 stop $*
          sleep 5
          $0 start $*
          ;;
  
    supervise)
         #
         # Under control of daemontools supervise monitor which
         # handles restarts and shutdowns via the svc program.
         #
           exec $RUN_CMD
           ;;
  
    run|demo)
          echo "Running Merlin: "
          echo " "
  
          if [ -f $MERLIN_PID ]
          then
              echo "Already Running!!"
              exit 1
          fi
  
          exec $RUN_CMD
          ;;
  
    check)
          echo "Checking arguments to Merlin: "
  	echo "MERLIN_HOME:     $MERLIN_HOME"
  	echo "MERLIN_TMPDIR:   $MERLIN_TMPDIR"
  	echo "MERLIN_JVM_OPTS: $MERLIN_JVM_OPTS"
  	echo "JAVA_HOME:        $JAVA_HOME"
          echo "JVM_OPTS:         $JVM_OPTS"
          echo "CLASSPATH:        $CLASSPATH"
          echo "RUN_CMD:          $RUN_CMD"
          echo
  
          if [ -f $MERLIN_PID ]
          then
              echo "Merlin running pid="`cat $MERLIN_PID`
              exit 0
          fi
          exit 1
          ;;
  
  *)
          usage
          ;;
  esac
  
  exit 0
  
  
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-platform/src/bin/run.sh
  
  Index: run.sh
  ===================================================================
  #! /bin/sh
  #
  # -----------------------------------------------------------------------------
  # Merlin start script. Based on the Avalon-Phoenix start script.
  #
  
  # OS specific support.  $var _must_ be set to either true or false.
  cygwin=false
  case "`uname`" in
  CYGWIN*) cygwin=true;;
  esac
  
  # resolve links - $0 may be a softlink
  THIS_PROG="$0"
  
  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"`
  MERLIN_HOME=`cd "$PRGDIR/.." ; pwd`
  
  unset THIS_PROG
  
  # For Cygwin, ensure paths are in UNIX format before anything is touched
  if $cygwin; then
    [ -n "$MERLIN_HOME" ] && MERLIN_HOME=`cygpath --unix "$MERLIN_HOME"`
  fi
  
  $MERLIN_HOME/bin/merlin.sh run $*
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org