export JAVA_OPTS=" -Ddeploy.app.name=jdos_consumerdaprpre -Ddeploy.app.id=1086342 -Ddeploy.instance.id=0 -Ddeploy.instance.name=server1"
#!/bin/bash
source /etc/profile
set -o nounset
SERVICE_NAME=web-launcher
app=$SERVICE_NAME.jar
function check_instance
{
pgrep -lf "$app" >/dev/null
}
function start_instance
{
local -i retry=0
if check_instance; then
echo "ERROR: instance process has already been started" >&2
exit 1
fi
BASEDIR=`dirname $0`/..
BASEDIR=$(readlink -f `(cd "$BASEDIR"; pwd)`)
HOME=$BASEDIR
PATH_TO_JAR=$HOME/$SERVICE_NAME.jar
JAVA_PATH=/usr/local/jdk1.8.0_291/bin/java
#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"
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"
nohup $JAVA_PATH $JAVA_TOOL_OPTIONS -jar $PATH_TO_JAR > /export/Logs/consumer.log 2>&1 &
sleep 1
while true; do
if check_instance; then
echo "Instance started successfully"
break
elif (( retry == 20 ));then
echo "ERROR: starting up instance has timed out" >&2
exit 1
else
echo -n "."
sleep 0.5
retry=$(( $retry + 1 ))
fi
done
}
start_instance
-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