Jar package under Linux system start-up mode

Linux runs jar package command as follows:

method one:

From java  jar shareniujar

Features: ssh current window is locked, press CTRL + C interrupted run, or close the window, the program exits

How to make a window that does not lock?

Second way

java -jar shareniu.jar &

& Representatives in the background.

Specific: ssh current window is not locked, but when the window is closed, the program is terminated.

Continue to improve, how to get the window is closed, the program is still running?

Three ways

nohup java -jar shareniu.jar &

nohup means not hang up the Run command, or exit the terminal when the account is closed, the program is still running

When used nohup command job, all of the default output is redirected to nohup.out job file unless specified output file.

Four ways

nohup java -jar shareniu.jar >temp.txt &

Under explain> temp.txt

command >out.file

command> out.file is the command to redirect the output to a file out.file that the contents do not print output to the screen, but out.file output to a file.

Tasks running in the background can be viewed through the jobs command

jobs

It will list all the background work, and has a number in front of each job.

If you want to control a job transferred back to the front desk, just fg + number can be.

fg 23

View a port occupied by the thread pid

netstat -nlp |grep :9181

If you forget the process ID, you can see the process ID jar package program currently running the following command

ps -ef|grep xxx.jar

Or ps -aux | grep java

// Process

kill -s 9 24204

24204 on behalf ISOLATED step process ID

Guess you like

Origin www.cnblogs.com/qingmuchuanqi48/p/11723541.html