Linux background process management tool: supervisor

Source: Internet
Author: User
Linux background process management tool: supervisorLinux background processes run in several ways, such as nohup and screen. However, if it is a service program, it must run reliably in the background, we need to turn it into a daemon, and it is better to monitor the process status, at the end of the accident when... linux background process management tool: the supervisor Linux background processes run in several ways, such as nohup and screen. However, if it is a service program, it must run reliably in the background, we need to make it daemon. it is better to monitor the process status and automatically restart it at the end of an accident. The supervisor is a set of common process management programs developed using Python. it can change a common command line process to a daemon in the background and monitor the process status. it can automatically restart upon abnormal exit. Install supervisorDebian/Ubuntu directly through apt: [html] # apt-get install supervisor. Then, write a configuration file for our self-developed application to allow the supervisor to manage it. The configuration files of each process can be split separately and placed in/etc/supervisor/conf. d/directory. conf as the extension, for example, app. conf defines a gunicorn process: [html] [program: app] command =/usr/bin/gunicorn-w 1 wsgiapp: application directory =/srv/www user = www-data where the process app is defined in [program: app], command is a command, and directory is the current directory of the process, user is the identity of the user who runs the process. Restart the supervisor to make the configuration file take effect. then run the supervisorctl command to start the process: [html] # supervisorctl start app to stop the process: [html] # supervisorctl stop app if you want to use variables in the command line, you need to write a shell script: [html] #! /Bin/sh/usr/bin/gunicorn-w 'grep-c ^ processor/proc/cpuinfo' wsgiapp: application and then add the x permission, point the command to the shell script.
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.