欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux java sh 博客分类: linux  

程序员文章站 2024-02-16 22:56:34
...

#! /bin/sh

 

if [ -z "$JAVA_HOME" ] ; then

export JAVA_HOME=/usr/local/java

fi

 

 

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do

  ls=`ls -ld "$SCRIPT"`

  # Drop everything prior to ->

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '/.*' > /dev/null; then

    SCRIPT="$link"

  else

    SCRIPT=`dirname "$SCRIPT"`/"$link"

  fi

done

 

SERVER_HOME=`dirname "$SCRIPT"`

SERVER_HOME=`cd "$SERVER_HOME" ; cd .. ; pwd`

export SERVER_HOME

 

LIBDIR=$SERVER_HOME/lib

 

CLASSPATH=${CLASSPATH}:${SERVER_HOME}/conf

 

for lib in ${LIBDIR}/*.jar

do

 CLASSPATH=$CLASSPATH:$lib

done

 

java=$JAVA_HOME/bin/java

 

JAVA_OPTS="

-Xmx1G

-Xms1G

-XX:PermSize=128M

-XX:MaxPermSize=256M

-XX:+UseConcMarkSweepGC

-XX:+UseParNewGC

-XX:+CMSConcurrentMTEnabled

-XX:+CMSParallelRemarkEnabled

-XX:+UseCMSCompactAtFullCollection

-XX:CMSFullGCsBeforeCompaction=0

-XX:+CMSClassUnloadingEnabled

-XX:LargePageSizeInBytes=128M

-XX:+UseFastAccessorMethods

-XX:+UseCMSInitiatingOccupancyOnly

-XX:CMSInitiatingOccupancyFraction=80

-XX:SoftRefLRUPolicyMSPerMB=0

-XX:+PrintClassHistogram

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps

-XX:+PrintHeapAtGC

-Xloggc:/data/logs/gc.log

-XX:+HeapDumpOnOutOfMemoryError

-XX:HeapDumpPath=/data/logs/dump.hprof

"

 

echo "JAVA_HOME  :$JAVA_HOME"

echo "SERVER_HOME:$SERVER_HOME"

echo "CLASSPATH  :$CLASSPATH"

echo "JAVA_OPTS  :$JAVA_OPTS"

 

cd $SERVER_HOME

 

exec  $java -classpath  $CLASSPATH  $JAVA_OPTS com.XX.XX.bootstrap