Daemontools Installation and use

Source: Internet
Author: User

Daemontools Installation and use



The daemontools is used to automatically restart the process. When a critical service process crashes, you can start it with Daemontools. The premise is to install and configure it. For example, the Zookeeper service, as a critical service, must be restarted after a crash. The installation and usage of Daemontools on RHEL6.4 (EL6) is described below.

1 Installing Daemontools

The first is el6 to install GCC:

# yum Install gcc

Then download and install the Daemontools:

# wget--no-check-certificate http://cr.yp.to/daemontools/daemontools-0.76.tar.gz# tar zxf daemontools-0.76.tar.gz# CD admin/daemontools-0.76/# sed-i ' s/extern int errno;/#include <errno.h>/1 './src/error.h#./package/install

2 Using Daemontools

Configure the startup item to add CSH-CF '/command/svscanboot & ' to the end of /etc/rc.local :

# sed '/$/acsh-cf \x27\/command\/svscanboot &\x27 '/etc/rc.local# source/etc/rc.local

Supervise monitors a directory (such as test), the test directory has an executable script run, and if the run script exits, supervise rerun it. So we write the logic of the startup service in the run script, for example, I monitor the operation of the Salt-minion service, and can write the following run script:

#!/bin/bashservice salt-minion startwhile truedo    ret= ' service salt-minion status|grep ' stopped '    if [-Z ' $ret ' ]; Then        Echo ' service was running '        sleep '    else        echo ' service is stopped '        break    Fidone

This script starts the Salt-minion service first, then determines whether the service is normal, and exits the break if it is not normal. Normally the loop is detected (the run script does not exit).

Then execute the following command to let supervise monitor it:

# supervise./test# svc-u./test

Daemontools Installation and use

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.