Continuously run the springboot project on the cloud server

Steps:

1. Use the maven clean command to remove the original jar package
Insert picture description here
2. Use the mvn package command to package the project into a jar package
Insert picture description here

3. Find the jar package in the target directory.
Insert picture description here
4. Use XShell and XFtp to complete upload, open security groups, open ports, etc.

5. Use the command to start the project

java -jar **.jar

This method will stop running when disconnecting the ssh connection

6. If you want to keep springboot running

nohup java -jar **.jar &

nohup: execute commands without hanging up, ignoring all hang up signals. Run the background command and finally add &
in the jar directory to generate a nohup.out file, and the default log is output here.

7. The default output file is modified to log.txt file in the current directory
· Demo.jar is started in the background without hanging up,
· "2>&1" means that the error and output are transmitted to the nohup.out file, the default state only outputs the output To the nohup.out file
· The nohup command defaults to the nohup.out file

nohup java -jar demo.jar >./log.txt  2>&1 &

Insert picture description here

7. Visit address
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41699562/article/details/101294548