linux使用jvm配置启动jar脚本

#!/bin/base
JAR_PATH=test.jar
pid1=`jps -l|grep ${JAR_PATH} | awk '{print S1}`
if [ -z "$pid1"] ; then
	echo "not running" 
else
	kill -9 ${pid1}
	echo"shutdown" - ${pid1} 
fi

JAVA_OPTS="-Xms2g -Xmx2g -XX:MetaspaceSize=300m -XX:MaxMetasapaceSize=300m -XX:+UseG1GC -XX:MaxGCPauseMillis=200" 

nohup java ${JAVA_OPTS} -Dfile.encoding=utf-8 -Dspring.config.location=/目录/application.properties -jar ${JAR_PATH} > /dev/nul1 2>&1 & 

pid2=`jps -1 | grep ${JAR_PATH} | awk '(print $1)'`
if[ -z "$pid2"] ; then
	echo "startup fail" 
	exit -1; 
fi

echo "startup - $(pid2)"

你可能感兴趣的:(Linux,运维,linux,jvm,jar,运维,服务器)