startup.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/sh
  2. error_exit ()
  3. {
  4. echo "ERROR: $1 !!"
  5. exit 1
  6. }
  7. [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
  8. [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
  9. [ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
  10. if [ -z "$JAVA_HOME" ]; then
  11. error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!"
  12. fi
  13. export SERVER="bankclear"
  14. export JAVA_HOME
  15. export JAVA="$JAVA_HOME/bin/java"
  16. export BASE_DIR=`cd $(dirname $0)/..; pwd`
  17. export DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
  18. export CUSTOM_SEARCH_LOCATIONS=${DEFAULT_SEARCH_LOCATIONS},file:${BASE_DIR}/conf/
  19. #===========================================================================================
  20. # JVM Configuration
  21. #===========================================================================================
  22. JAVA_OPT="${JAVA_OPT} -Xms1024m -Xmx1024m -Xmn512m"
  23. #JAVA_OPT="${JAVA_OPT} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
  24. JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${BASE_DIR}/plugins/cmdb:${BASE_DIR}/plugins/mysql"
  25. JAVA_OPT="${JAVA_OPT} -Dsystem.basedir=${BASE_DIR}"
  26. JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins/health -jar ${BASE_DIR}/target/${SERVER}.jar"
  27. JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
  28. JAVA_OPT="${JAVA_OPT} --spring.config.location=${CUSTOM_SEARCH_LOCATIONS}"
  29. JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/log4j2.xml"
  30. JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288"
  31. if [ ! -d "${BASE_DIR}/logs" ]; then
  32. mkdir ${BASE_DIR}/logs
  33. fi
  34. echo "$JAVA ${JAVA_OPT}"
  35. echo "cbm is starting ..."
  36. nohup $JAVA ${JAVA_OPT} pd >> /dev/null 2>&1 &
  37. echo "cbm is starting,you can check the ${BASE_DIR}/logs/default.log"