Program in the Linux background to run the method (turn off the terminal to continue to allow the program to run the method) __linux

Source: Internet
Author: User

Problem Description: A program developed on a Linux server that interrupts the execution of a remote connection, but the running program shuts down automatically as a child of the terminal window. I want the program to run in the background of the terminal, and the program can still run after the terminal is closed.

(1) To enable the program in the background to run the method

Typically, we add & to the command (such as the following statement executes the executable file in the background tcpserverfinal)

./tcpserverfinal &

Close Daemon method: Use the Jobs command to list the running processes, and use the KILL command to end the process (PID is the process number that is queried with the jobs command).

Jobs-l
Kill PID

(2) The program that has been run continues to run in the background

Ctrl+z Suspend task

Enter the BG command to put the pending task back in the background to continue execution.


(3) The program is executed in the background, and the terminal window is closed and is not interrupted as a subprocess: plus the nohup command

 

This closes the terminal and the program continues to run.

How to turn off the process running in the background: Use the PS-A command to query the process's PID process number, and then terminate the process with the kill command.



More related method reference: Make the program run in Linux background (turn off the terminal to continue to allow the program to run the method)

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.