Run the JAR package program under Linux with nohup background

Source: Internet
Author: User

The Linux run Jar Package command is as follows:

Way One:

    1. Java-jar Xxx.jar

Features: The current SSH window is locked, you can press CTRL + C to interrupt the program to run, or directly close the window, the program exits

How do I make the window unlocked?

Way Two

    1. Java-jar Xxx.jar &

The & Representative runs in the background.

Specific: The current SSH window is not locked, but when the window is closed, the program stops running.

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

Mode three

Nohup Java-jar Xxx.jar &

Nohup means not to hang up the Run command, when the account exits or the terminal shuts down, the program still runs

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

Mode Four

    1. Nohup Java-jar Xxx.jar >temp.txt &

Explain the next >temp.txt.

Command >out.file

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

The jobs command allows you to view the running tasks in the background

    1. Jobs

All jobs that are executed in the background are listed, and each job has a number in front of it.
If you want to bring a job back to the foreground control, only the FG + number is required.

    1. FG 23

To view the PID of a thread occupied by a port

NETSTAT-NLP |grep:9181

Run the JAR package program under Linux with nohup background

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.