Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the specific method of running jar in the background of Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly analyzes the relevant knowledge of what is the specific method of running jar in the background of Linux, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "what is the specific method of running jar in the background of Linux".

When the java project is deployed in the Linux system, it is directly packaged into jar to deploy and run. Because SpringBoot already has a built-in Tomcat container, there is no need to run the jar package in other web containers, so deployment is more convenient.

Linux runs the jar package command as follows: way 1 java-jar shareniu.jar characteristics: the current ssh window is locked, you can press CTRL + C to interrupt the program, or close the window directly, the program exits

So how to keep the window unlocked?

Method 2: java-jar shareniu.jar & & stands for running in the background.

Specific: the current ssh window is not locked, but the program stops running when the window closes.

Continue to improve, how to keep the program running when the window closes?

Mode 3: nohup java-jar shareniu.jar & nohup means to run the command without hanging up. When the account exits or the terminal closes, the program is still running.

When a job is executed with the nohup command, all output from the job is redirected to the nohup.out file by default, unless another output file is specified.

Mode 4: nohup java-jar shareniu.jar > / dev/null & explain > temp.txt

Command > out.file

Command > out.file redirects the output of command to the out.file file, that is, the output is not printed to the screen, but to the out.file file.

You can view background running tasks through the jobs command

Jobs then lists all jobs executed in the background, and each job is preceded by a number. If you want to transfer a job back to the front desk, all you need is a fg + number.

Fg 23 views the pid of threads occupied by a port

Netstat-nlp | grep: 9181 this is the end of the introduction about "what is the specific method of running jar in the background of Linux". More related content can be searched for previous articles, hoping to help you answer questions and questions, please support the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 301

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report