| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
javapp
10年前发布

一个通用的java应用程序启动shell脚本

一个通用的java应用程序启动shell脚本

#!/bin/sh  current_path=`pwd`  case "`uname`" in      Linux)        bin_abs_path=$(readlink -f $(dirname $0))        ;;     *)        bin_abs_path=`cd $(dirname $0); pwd`        ;;  esac  base=${bin_abs_path}/..  export LANG=en_US.UTF-8  export USER_CLASSPATH=$USER_CLASSPATH:$base/conf    if [ -f $base/bin/worker.pid ] ; then     echo "found worker.pid , Please run stop.sh first ,then startup.sh" 2>&2      exit 1  fi    for f in $base/lib/*.jar; do    if [ "$USER_CLASSPATH" ]; then      export USER_CLASSPATH=$USER_CLASSPATH:$f    else      export USER_CLASSPATH=$f    fi  done    USER_OPTION=-Duser.dir=$base  JAVA_OPTS="-server -Xms512m -Xmx512m -Xmn128m -XX:SurvivorRatio=2 -XX:PermSize=16m -XX:MaxPermSize=32m -Xss256k -XX:-UseAdaptiveSizePolicy -XX:MaxTenuringThreshold=15 -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError"  WORKER_OPTS="-DappName=jbus-worker"    echo $base    java $JAVA_OPTS -cp $USER_CLASSPATH $USER_OPTION $WORKER_OPTS cn.outofmemory.worker.Main >> $base/logs/worker.log 2>&1 &  echo $! > $base/bin/worker.pid  cat worker.pid | xargs echo "worker start... "