There are three ways to start a springboot project: 1. Run the main method program 2. Use the command mvn spring-boot:run to run on the command line 3. After using mvn packpage to package the jar file, run it using the java -jar yourapp.jar command line Generally, we often use the first two running modes when developing, and the third mode when deploying and implementing. Below we will focus on downloading the instructions and scripts for running and stopping the springboot project in the Linux environment: 1. Instructions nohup does not hang up the run command Generally, you can use it directly in Linux: java -jar yourapp.jar To start the program, but once the process is terminated, the program will immediately hang up, so in this case, we have to use nohup nohup java -jar yourapp.jar > yourapp.out 2>&1 & But the biggest problem is that it is inconvenient to manage. what to do? Second, write a shell script 1. start.sh #!/bin/bash nohup java -jar yourapp.jar -Xms256m -Xmx1024m > yourapp.out 2>&1 & 2. stop.sh #!/bin/bash PID=$(ps -ef | grep yourapp.jar | grep -v grep | awk '{ print $2 }') if [ ${PID} ]; then echo 'Application is stpping...' echo kill $PID DONE kill $PID else echo 'Application is already stopped...' fi 3. Integrate the start and stop scripts and write run.sh #!/bin/bash echo 'Application is stpping...' source stop.sh echo 'Application is running...' source start.sh binggo… Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Summary of 10 must-see JavaScript interview questions (recommended)
>>: Detailed explanation of how to install MySQL on Alibaba Cloud
introduce This article is based on React + antd t...
This article example shares the specific code of ...
HTML Paragraph Paragraphs are defined by the <...
This article shares the specific code of js+Html ...
Solve the problem that the responseText returned ...
This article shares with you the installation and...
If you are a developer looking to get into the wo...
Table of contents Why use gzip compression? nginx...
1. Download MySQL from the official website: This...
Cause of failure Today, when I was writing a caro...
I believe many programmers are familiar with MySQ...
Writing a Dockerfile Taking the directory automat...
There are two ways to install MySQL 5.7. One is t...
Table of contents Preface Creation steps Create a...
<br />A great blog post by PPK two years ago...