1. What is daemon process
In Linux or Unix operating systems, the daemon (Daemon) is a special process that runs in the background, independent of the control terminal and periodically performs some sort of task or waits for certain occurrences to be handled. Because in Linux, each system communicates with the user interface called the terminal, every process that starts from this terminal is attached to this terminal, this terminal is called the control terminal of these processes, when the control terminal is closed, the corresponding process will automatically shut down. However, the daemon can break this limit, it is out of the terminal and runs in the background, and it is out of the terminal to avoid the process of information in the process of running in any terminal and the process will not be interrupted by terminal information generated by any terminal. It starts running from the time it was executed until the entire system shuts down before exiting.
2. Role of Daemons
Daemons often start when the system boots, and terminate when the system shuts down. Linux systems have many daemons, most of which are implemented through daemons, while the daemon can accomplish many system tasks, such as the job planning process Crond, the printing process lqd, and so on (the end letter D is the daemon meaning).
3. Supervisor Introduction
Linux background process has several methods, such as Nohup,screen, but, if it is a service program, to reliably run in the background, we need to make it daemon, it is best to monitor the status of the process, at the end of the accident can automatically restart. Supervisor is a set of common process management programs developed with Python that can turn a normal command-line process into a background daemon and monitor the status of the process, which can be restarted automatically when the exception exits.
4. Supervisor Installation
4.1 Debian/ubuntu can be installed directly via APT
# Apt-get Install Supervisor
4.2 Test whether the installation was successful
# PS Ax | grep Supervisor
5. Configure Supervisor
Each process configuration file can be split separately, placed in the/etc/supervisor/conf.d/directory, with. conf as the extension, for example, app.conf defines a HelloWorld process
[Program:helloword]
Command=/data/app/helloworld
Directory=/data/app
6. Start Supervisor
/etc/init.d/supervisor restart
Simple Linux daemon installation, configuration, use of the process, I hope you have some help.
Public Number: ludong86
The supervisor of the Linux daemon