执行spring boot jar包
程序员文章站
2022-05-01 13:04:29
...
例:maila-manager-web-test01.sh
function start() {
JAVA_OPTS="$JAVA_OPTS -server
-Xmx512m
-Xms256m
-Xmn256m
-XX:MetaspaceSize=64m
-XX:MaxMetaspaceSize=256m
-Xss256k
-XX:+ExplicitGCInvokesConcurrent
-XX:+UseConcMarkSweepGC
-XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=70
-XX:-UseBiasedLocking
-XX:AutoBoxCacheMax=20000
-XX:MaxTenuringThreshold=6
-Xloggc:/dev/shm/gc_maila-manager-web.log
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+PrintCodeCache
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=2
-XX:GCLogFileSize=10m
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/home/admin/logs/ "
nohup java $JAVA_OPTS -jar /home/admin/duiba-deploy/maila-manager-web/maila-manager-deploy/build/libs/maila-manager-web-0.1.0.jar --spring.config.location=http://configserver.duiba.com.cn/maila-manager-web-pre.properties > /dev/null &
}
function stop() {
process=`ps -ef | grep 'maila-manager-web' | grep -v "grep"|grep -v "restart"|grep -v "stop"| wc -l`
if [[ 0 != $process ]];then
ps -ef | grep 'maila-manager-web' | grep -v "grep"|grep -v "stop"|grep -v "restart"| awk '{print $2}' | xargs kill -15
fi
sleep 10
if [[ 0 != $process ]];then
ps -ef | grep 'maila-manager-web' | grep -v "grep"|grep -v "stop"|grep -v "restart"| awk '{print $2}' | xargs kill -9
fi
}
function restart() {
stop;
sleep 1;
start;
}
}
function status() {
ps -ef | grep 'maila-manager-web' | grep -v grep| awk '{print $2}'
}
function help() {
echo "$0 |start|stop|restart|status|"
}
if [ "$1" == "" ]; then
help
elif [ "$1" == "stop" ];then
stop
elif [ "$1" == "start" ];then
start
elif [ "$1" == "restart" ];then
restart
elif [ "$1" == "status" ];then
status
else
help
fi
执行: ./maila-manager-web-test01.sh start
上一篇: Spring boot多线程支持
下一篇: hive分桶表排序
推荐阅读
-
spring boot使用自定义的线程池执行Async任务
-
spring boot aop 记录方法执行时间代码示例
-
Spring Boot2.3 新特性分层JAR的使用
-
Spring Boot项目添加外部Jar包以及配置多数据源的完整步骤
-
Spring框架学习笔记(6)——阿里云服务器部署Spring Boot项目(jar包)
-
【源码解析】凭什么?spring boot 一个 jar 就能开发 web 项目
-
Spring Boot 直接用jar运行项目的方法
-
JAVA SpringBoot 项目打成jar包供第三方引用自动配置(Spring发现)解决方案
-
Spring Boot创建可执行jar包的实例教程
-
spring boot jar的启动原理解析