Home> Java> javaTutorial> body text

How to start or stop the SpringBoot project in Centos

WBOY
Release: 2023-05-17 20:55:25
forward
786 people have browsed it

使用Maven脚本在Centos服务器中启动与停止项目

首先项目需要引用Maven的SpringBoot插件

  boot-repackage    org.springframework.boot spring-boot-maven-plugin   org.apache.maven.plugins maven-surefire-plugin 2.18.1  true      
Copy after login

启动项目脚本

以项目名为rongyuan-project为例需先执行停止项目脚本

#!/bin/sh sh bin/stop.sh git pull nohup mvn spring-boot:run -Drun.profiles=prod & tailf nohup.out
Copy after login

项目停止脚本

以项目名为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
Copy after login

tips:在项目中mkdir bin文件夹,然后在bin目录下touch start.sh与stop.sh,即可在项目中执行脚本,并且目录结构也更加优美.

The above is the detailed content of How to start or stop the SpringBoot project in Centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!