amoeba

#!/bin/bash

#-------------------------------------------------------------------
#    Amoeba Bootstrap Script
#
#    需要设置如下环境变量:
#
#      JAVA_HOME           - JDK的安装路径
#
#-------------------------------------------------------------------

# 判断是否在cygwin环境下
cygwin=false;
case "`uname`" in
  CYGWIN*) cygwin=true ;;
esac

# 确定安装了java,并设置了JAVA_HOME环境变量.
noJavaHome=false
if [ -z "$JAVA_HOME" ] ; then
    noJavaHome=true
fi
if $cygwin ; then
    [ -n "$JAVA_HOME" ] &&
        JAVA_HOME=`cygpath -u "$JAVA_HOME"`
fi
if [ ! -e "$JAVA_HOME/bin/java" ] ; then
    noJavaHome=true
fi
if $noJavaHome ; then
    echo "Error: JAVA_HOME environment variable is not set."
    exit 1
fi

# 用该脚本的位置推断AMOEBA_HOME的路径.
CURR_DIR=`pwd`
cd `dirname "$0"`/..
AMOEBA_HOME=`pwd`
cd $CURR_DIR

if [ -z "$AMOEBA_HOME" ] ; then
    echo
    echo 错误: 必须设置环境变量“AMOEBA_HOME”,指向AMOEBA的安装路径
    echo
    exit 1
fi

CLASSPATH="$AMOEBA_HOME/lib/classworlds-1.0.jar"
MAIN_CLASS="org.codehaus.classworlds.Launcher"

if $cygwin ; then
    JAVA_HOME=`cygpath -w "$JAVA_HOME"`
    AMOEBA_HOME=`cygpath -w "$AMOEBA_HOME"`
    CLASSPATH=`cygpath -p -w "$CLASSPATH"`
fi


DEFAULT_OPTS="-server -Xms256m -Xmx512m -Xss512k"
# DEFAULT_OPTS="$DEFAULT_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -XX:+UseParallelGC -XX:+UseBiasedLocking -XX:NewSize=64m"
DEFAULT_OPTS="$DEFAULT_OPTS -Damoeba.home=\"$AMOEBA_HOME\""
DEFAULT_OPTS="$DEFAULT_OPTS -Dclassworlds.conf=\"$AMOEBA_HOME/bin/amoeba.classworlds\""

CMD="exec \"$JAVA_HOME/bin/java\" $DEFAULT_OPTS $OPTS -classpath \"$CLASSPATH\"  $MAIN_CLASS $@"
eval $CMD

你可能感兴趣的:(amoeba)