这篇文章主要介绍了Centos下SpringBoot项目启动与停止脚本的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
使用Maven脚本在Centos服务器中启动与停止项目
首先项目需要引用Maven的SpringBoot插件
boot-repackage org.springframework.bootspring-boot-maven-plugin org.apache.maven.pluginsmaven-surefire-plugin2.18.1 true
启动项目脚本
以项目名为rongyuan-project为例需先执行停止项目脚本
#!/bin/sh sh bin/stop.sh gi<strong style="color:transparent">来源gaodaima#com搞(代@码网</strong>t pull nohup mvn spring-boot:run -Drun.profiles=prod & tailf nohup.out
项目停止脚本
以项目名为rongyuan-project为例
#!/bin/bash PID=$(ps -ef | grep rongyuan-project | grep -v grep | awk '{ print $2 }') if [ -z "$PID" ] then echo rongyuan is already stopped else echo kill $PID kill $PID fi
tips:在项目中mkdir bin文件夹,然后在bin目录下touch start.sh与stop.sh,即可在项目中执行脚本,并且目录结构也更加优美.
以上就是Centos下SpringBoot项目启动与停止脚本的方法的详细内容,更多请关注gaodaima搞代码网其它相关文章!