start.sh 1.0 KB
Newer Older
苗卫卫 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#!/bin/bash
jar_name="nbd-wios-manage-2.0.0.jar"
#server_port="30350"
nacos_server_addr="10.12.1.17:8848"
nacos_server_namespace="ce18ccbc-e054-45ad-893f-ed7ebee1704b"
jar_pid=`ps -ef|grep -v grep | grep ${jar_name}|awk '{ print $2 }'`
echo "$jar_pid"
if [ ! -n "$jar_pid" ]; then
echo "${jar_name} will redeploy."
else
kill -9 $jar_pid
echo "kill ${jar_pid}"
fi

#jar opt
# -xms:default value physical memory/64
# -Xmx:default value physical memory/4
# -Xmn:default value -xms/3
jar_opt="-Xms512m -Xmx2048m -Xmn256m -XX:MetaspaceSize=128M"
jar_opt="${jar_opt} -Xloggc:./logs/gc.vgc"
jar_opt="${jar_opt} -XX:-OmitStackTraceInFastThrow"
# local param
#jar_opt="${jar_opt} -Dspring.profiles.active=pro"
# log
#jar_opt="${jar_opt} -Dlog.home=../logs"
# server.port
#jar_opt="${jar_opt} -Dserver.port=${server_port}"
# naocs
jar_opt="${jar_opt} -Dnacos-server-addr=${nacos_server_addr} -Dnacos-server-namespace=${nacos_server_namespace}"

# start
rm -rf nohup.out
nohup java ${jar_opt} -jar $jar_name &
echo "${jar_name} start success."