First, you need to enter the root directory of your springboot project, and then execute the following linux command
nohup java -jar own springboot project.jar >log file name.log 2>&1 &
Detailed explanation of the command:
nohup: Run the command without hang up, and continue to run the corresponding process after exiting the account.
>Log file name.log: Nohup redirects the output of command to the specified "log file name.log" file in the current directory, that is, the output content is not printed on the screen, but outputs to the "log file name.log" file. Not specifying a file name creates nohup.out in the current directory. If the nohup.out file in the current directory is not writable, the output is redirected to the $HOME/nohup.out file. If no file can be created or opened for appending, the command specified by the Command parameter is not invoked.
2>&1:2 means standard error, 1 means standard output, is this command equivalent to redirecting standard error to standard output? Here & is equivalent to standard errors equivalent to standard output, that is, output standard errors and standard output to the specified "log file name.log" file at the same time.
java -jar own springboot project.jar: Execute springboot project. If you execute the command alone, Linux will only run the project briefly. When exiting the console, the project will be automatically closed.
The last &: Let the job change run in the background.
Summarize
The above is the method of running springboot in the Linux background introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!