Booting a program from the CentOS boot

Source: Internet
Author: User

SYSTEMD is a Linux system tool used to launch daemons and has become the standard configuration for most distributions. You can systemctl --version view the version you are using by command

Common commands

# 立即启动一个服务$ sudo systemctl start apache.service# 立即停止一个服务$ sudo systemctl stop apache.service# 重启一个服务$ sudo systemctl restart apache.service# 杀死一个服务的所有子进程$ sudo systemctl kill apache.service# 重新加载一个服务的配置文件$ sudo systemctl reload apache.service# 重载所有修改过的配置文件$ sudo systemctl daemon-reload# 显示某个 Unit 的所有底层参数$ systemctl show httpd.service
Supervisor

Supervisor is a process management program written in Python that can be used not only to manage processes, but also to boot. It has, but is not limited to, some of the following features:

After restarting the machine, it is capable of self-booting.
Usually there is a convenient way to view the process.
There is a convenient way to restart the process.

Configuration methods do not record here, but note that the default configuration file will be some of the supervisor generated important files in the /tmp directory, the operating system may delete these files, resulting in the supervisorctl command because they could not find these previously placed in /tmp Files and cannot operate the supervisor process that has already been started.

Method

In order to be able to automatically start supervisor after the machine starts, the supervisor process needs to be configured into SYSTEMD,

Steps:

    1. Enter the directory /usr/lib/systemd/system/ and add files to supervisord.service enable the machine to start Supervisor, file content
# Supervisord service for SYSTEMD (CentOS 7.0+) # by Et-cs (Https://github.com/ET-CS) [unit] description=supervisor daemon[service] type=forkingexecstart=/usr/bin/supervisord-c/etc/ Supervisord.confexecstop=/usr/bin/supervisorctl  $OPTIONS Shutdownexecreload=/usr/bin/supervisorctl  $OPTIONS reload< Span class= "hljs-attr" >killmode=processrestart=on-failure< Span class= "hljs-attr" >restartsec=42s[Install]wantedby=multi-user.target           
    1. Activating the boot command

      enable supervisord.service
    2. Start the Supervisor process

      start supervisord.service
    3. Close the Supervisor process

      stop supervisord.service
    4. If you modify the Supervisor.service file, you can reload the configuration file by using the reload command

      systemctl reload supervisord.service
Check

Commands allow you to ps see whether supervisor is started, and you can see whether the supervisor managed process is started.

Booting a program from the CentOS boot

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.