In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to achieve jar package startup and jar package background operation in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Linux runs the jar package command as follows:
Method 1:
Java-jar shareniu.jar
Features: the current ssh window is locked, you can press CTRL + C to interrupt the program, or close the window directly, and the program exits
So how to keep the window unlocked?
Mode two
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 > temp.txt &
Explain to me > 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 all jobs executed in the background are listed, 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
View the pid of threads occupied by a port
Netstat-nlp | grep: 9181
If you forget the process number, you can view the process number of the currently running jar package with the following command
Ps-ef | grep xxx.jar
Or ps-aux | grep java
/ / close the process
Kill-s 9 24204
24204 represents the process ID found in the previous step
These are all the contents of the article "how to start the jar package and run the jar package in the background in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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: 0
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.