Linux Common Daemon Daemon process

Source: Internet
Author: User
Tags zookeeper

I. Common process and background process

By default, the process is running in the foreground, so the shell is occupied and we cannot do anything else. For those processes that do not interact, many times, we want to start it in the background and add a ' & ' to the startup parameters to achieve this:

 [Email protected]:~/application/zookeeper-8 /bin$./zkserver. sh  start &[ 1 ] 21304  [email protected]:  ~/application/zookeeper- 3.4 . 8 /bin$ ZooKeeper JMX enabled by defaultusing Config: /home/zsm/application/zookeeper-3.4 . 8 /bin/. /conf/zoo.cfgstarting zookeeper ... started[ 1 ]+ done./zkserver.sh  Start 

When the process switches to the background, we call it job. Switching to the background will output the relevant job information, with the previous output as [1] 21304 cases: [1] indicates that the job ID is 21304 indicates that the process ID is 21304. Processes that switch to the background can still be viewed with the PS command, or only see all jobs (background process) through the job command

Second, the Guardian process

If a process is always started in the background and cannot be exited by a shell exit, it is a legitimate practice to create it as a daemon (daemon). The daemon is worth the long-running background process of the system, similar to Windows services. Daemon information through Ps–a can not see, need to use the –x parameter, when the

With this command, you often attach the-j parameter to view the job control information, where the Tpgid column, 1, is the daemon.

Third, daemon process and background process

The file descriptor of the background process also inherits from the parent process, such as the shell, so it can also display output data under the current terminal. But the daemon process itself becomes the process leader, its file description symbol and control terminal is not related, is the console independent.

Basically any program can be run in the background, but the daemon is a special requirement of the program, such as to get rid of their own parent process, to become their own conversation leader, and so on, these to be explicitly written in the code in other words, the daemon is definitely a background process, but the reverse is not true.

Iv. several commands related to system tasks

FG, BG, Jobs, &, CTRL + Z

1. & is most often used

This is used at the end of a command, you can put this command in the background to execute

2. Ctrl + Z

You can put a command that is executing in the foreground in the background and pause

3. Jobs

See how many commands are currently running in the background

4. FG

Move commands in the background to the foreground to continue running

If there are multiple commands in the background, you can use FG%jobnumber to bring up the selected command,%jobnumber is the ordinal (not PID) of the command being executed in the background through the jobs command.

5. BG will suspend a command in the background and change to continue execution

If there are multiple commands in the background, you can use BG%jobnumber to bring up the selected command,%jobnumber is the ordinal (not PID) of the command being executed in the background through the jobs command.

1. Jobs lists background job information. ([job number] Run status job name)

2. Ctrl + Z put the task back in the background and pause;

3. BG <%int> Wake up background tasks and run in the background;

4. FG <%int> put the post-mission procedures in the foreground;

Linux Common Daemon Daemon process

Related Article

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.