点击(此处)折叠或打开

  1. #!/bin/bash
  2. cd `dirname $0`
  3. BIN_DIR=`pwd`
  4. #cd ..
  5. DEPLOY_DIR=`pwd`
  6. CONF_DIR=$DEPLOY_DIR/conf
  7. STDOUT_FILE=logs/test.log
  8. LIB_DIR=$DEPLOY_DIR/lib
  9. #echo "LIB_DIR is :$LIB_DIR"
  10. LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
  11. JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
  12. JAVA_DEBUG_OPTS=""
  13. if [ "$1" = "debug" ]; then
  14. JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
  15. fi
  16. JAVA_JMX_OPTS=""
  17. if [ "$1" = "jmx" ]; then
  18. JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
  19. fi
  20. JAVA_MEM_OPTS=""
  21. BITS=`java -version 2>&1 | grep -i 64-bit`
  22. if [ -n "$BITS" ]; then
  23. JAVA_MEM_OPTS=" -server -Xmx1g -Xms1g -Xmn512m -XX:PermSize=128m -Xss256k -verbose:gc -Xloggc:/data/logs/t-sc-uc-gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
  24. else
  25. JAVA_MEM_OPTS=" -server -Xms1g -Xmx1g -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
  26. fi
  27. export gc_output_file_nam=server_gc.txt
  28. echo "gc ouput file name: $gc_output_file_nam"
  29. echo -e "Starting the $SERVER_NAME ...\c"
  30. echo ""
  31. #nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS Rhetoric.RhetoricManager > $STDOUT_FILE 2>&1 &
  32. echo java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -Xloggc:$gc_output_file_nam -classpath $CONF_DIR:$LIB_JARS server.HelloServer
  33. #java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -Xloggc:$gc_output_file_nam -classpath $CONF_DIR:$LIB_JARS server.HelloServer
  34. java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -Xloggc:$gc_output_file_nam -classpath $CONF_DIR:$LIB_JARS cluster_client.Main
  35. #java -jar bin/DiagnosticEngine.jar ./conf/article_diagnostic_engine.conf
  36. #echo "OK!"
  37. PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
  38. #echo "PID: $PIDS"
  39. #echo "STDOUT: $STDOUT_FILE"

12-11 14:20