Monitoring process status and automatic restart process under Unix/linux __linux

Source: Internet
Author: User
Tags memcached

Tools: Daemontools

Daemontools is a set of UNIX service Administration tools developed by QMail's author DJB, where a program named supervise can be used for service startup, stop service restart, and so on.

Installation:
Create A/package Directory:

Mkdir-p/package
chmod 1755/package
Cd/package

Download http://cr.yp.to/daemontools/daemontools-0.76.tar.gz Into/package. Unpack the Daemontools package:

Gunzip Daemontools-0.76.tar
TAR-XPF Daemontools-0.76.tar
Rm-f Daemontools-0.76.tar
CD admin/daemontools-0.76

Compile and set up the Daemontools programs:

Package/install


Test whether the installation was successful:

# Ps-ef | grep Svscan

# Mans Svscan

Use the supervise program for program management monitoring, take memcache as an example, Memcache directory is in/usr/local/memcache

Create a new corner in the Memcache directory this file

#vim Run


The contents are as follows

#!/bin/sh

EXEC 2>&1

Exec/usr/local/memcache/bin-u root-d

Run:

Supervise/usr/local/memcache

Verify that the monitoring memcache is successful:

kill-9 [memcached PID]---kill the process
Ps-aux|grep memcached----View process


To view the process, if there is a memcached process "just different than the previous PID", the automatic reboot is successful.

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.