1. export JAVA_OPTS=" -Ddeploy.app.name=jdos_consumerdaprpre -Ddeploy.app.id=1086342 -Ddeploy.instance.id=0 -Ddeploy.instance.name=server1"
    2. #!/bin/bash
    3. source /etc/profile
    4. set -o nounset
    5. SERVICE_NAME=web-launcher
    6. app=$SERVICE_NAME.jar
    7. function check_instance
    8. {
    9. pgrep -lf "$app" >/dev/null
    10. }
    11. function start_instance
    12. {
    13. local -i retry=0
    14. if check_instance; then
    15. echo "ERROR: instance process has already been started" >&2
    16. exit 1
    17. fi
    18. BASEDIR=`dirname $0`/..
    19. BASEDIR=$(readlink -f `(cd "$BASEDIR"; pwd)`)
    20. HOME=$BASEDIR
    21. PATH_TO_JAR=$HOME/$SERVICE_NAME.jar
    22. JAVA_PATH=/usr/local/jdk1.8.0_291/bin/java
    23. #JAVA_TOOL_OPTIONS="-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Dspring.config.location=/export/App/config/application.yml,/export/App/config/application-consumer.yml"
    24. JAVA_TOOL_OPTIONS="-Djava.library.path=/usr/local/jdk1.8.0_291/lib -server -Xms6144m -Xmx6144m -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/export/Logs -Djava.awt.headless=true -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000 -Djmagick.systemclassloader=no -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.ttl=300 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Dspring.config.location=/export/App/config/application.yml,/export/App/config/application-consumer.yml"
    25. nohup $JAVA_PATH $JAVA_TOOL_OPTIONS -jar $PATH_TO_JAR > /export/Logs/consumer.log 2>&1 &
    26. sleep 1
    27. while true; do
    28. if check_instance; then
    29. echo "Instance started successfully"
    30. break
    31. elif (( retry == 20 ));then
    32. echo "ERROR: starting up instance has timed out" >&2
    33. exit 1
    34. else
    35. echo -n "."
    36. sleep 0.5
    37. retry=$(( $retry + 1 ))
    38. fi
    39. done
    40. }
    41. start_instance
    1. -Djava.library.path=/usr/local/jdk1.8.0_291/lib \
    2. -server \
    3. -Xms6144m \
    4. -Xmx6144m \
    5. -XX:MaxMetaspaceSize=256m \
    6. -XX:+HeapDumpOnOutOfMemoryError \
    7. -XX:HeapDumpPath=/export/Logs -Djava.awt.headless=true \
    8. -Dsun.net.client.defaultConnectTimeout=60000 \
    9. -Dsun.net.client.defaultReadTimeout=60000 \
    10. -Djmagick.systemclassloader=no \
    11. -Dnetworkaddress.cache.ttl=300 \
    12. -Dsun.net.inetaddr.ttl=300 \
    13. -Dsun.jnu.encoding=UTF-8 \
    14. -Dfile.encoding=UTF-8 \
    15. -Dspring.config.location=/export/App/config/application.yml,/export/App/config/application-consumer.yml