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
Get daily statistics When doing a project, you ne...
Asynchronous replication MySQL replication is asy...
Dynamic rem 1. First, let’s introduce the current...
1. Search mysql in the browser to download and in...
If you only want to back up a few tables or a sin...
Exporting Data Report an error SHOW VARIABLES LIK...
Six steps to install MySQL (only the installation...
This question is very strange, so I will go strai...
Blockquote Definition and Usage The <blockquot...
Nginx's configuration syntax is flexible and ...
This article is just to commemorate those CSS que...
The solutions to the problems encountered during x...
Debug branch During the normal development of a p...
Table of contents Overview Application scenarios ...
If the field storing the name uses the GBK charac...