nohup-Back-end Daemon

Source: Internet
Author: User

To place a command in the background, we generally use nohup SH Command &

Why are you nohup?

Because I use SCRT to exit with this terminal tool, a sighup signal is given to the process that we started under the current shell,

The default behavior of the SIGHUP signal terminates the process, so nohup means shielding the sighup signal.

Let's do a test:

run a background program without nohup in a window [email protected]~]#SHTestlsof.SH>111. Log &[1]4486[[Email protected]~]# jobs[1]+ RunningSHTestlsof.SH>111. Log &View background program in another window [email protected]~]#PS-ef|grepTestlsofroot4486  4315  0  -: Onepts/1    xx:xx:xx SHTestlsof.SHRoot4574  4500  0  -: Apts/0    xx:xx:xx greptestlsof Close the first window and the background process exits [email protected]~]#PS-ef|grepTestlsofroot4661  4500  0  -: Apts/0    xx:xx:xx grepTestlsof running a background program with nohup in a window [[email protected]~]# NohupSHTestlsof.SH>111. Log &[1]2710[[Email protected]~]# nohup: Ignore input redirect error to standard output [[email protected]~]# jobs[1]+ Running NohupSHTestlsof.SH>111. Log &View background program in another window [email protected]~]#PS-ef|grepTestlsofroot2710  2664  0  -: atpts/1    xx:xx:xx SHTestlsof.SH   //parent process is shellRoot2794  2728  0  -: atpts/2    xx:xx:xx greptestlsof Close the first window, background process does not exit [email protected]~]#PS-ef|grepTestlsofroot2710     1  0  -: at?xx:xx:xx SHTestlsof.SH<span style="font-family:arial, Helvetica, Sans-serif;">//Parent process for init process </span>Root3223  2728  0  -: atpts/2    xx:xx:xx grepTestlsof

PS is the most common and very powerful process view command under Linux.

A common use method is to check whether a process exists:

The following command checks to see if the Java process exists.
Ps-ef |grep Java

1. Introduction to PS

To monitor and control the process, you must first understand the current process, that is, you need to see the current process, and the PS command is the most basic

It is also a very powerful process to view commands. Use this command to determine which processes are running and running, whether the process is complete,

The process has no zombie, which processes occupy too much resources, and so on. In short, most of the information can be obtained by executing the command.

2. PS command and its parameters

PS commands are most commonly used to monitor background process work, because background processes are not and on-screen Keyboard These standard input/output setting

The PS command can be used if it is necessary to detect the condition.

The syntax format for this command is as follows:

PS [Options]

The following is a description of the command options:

-e Displays all processes.

-F full format.

-H does not display the caption.

-L long format.

-W wide output.

A shows all processes on the terminal, including the processes of other users.

R displays only the processes that are running.

X shows the process with no control of the terminal.

nohup-Back-end Daemon

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.