Supervise is a tool for daemontools that can be used to monitor the application running under UNIX. When the application has an exception, Supervise can restart the specified program. This article briefly introduces the installation and use of Supervise.
First, install
Create a / pacakage directory (you can create any directory, here using package is just to maintain the consistency of the English author):
Mkdir -P / packagechmod 1755 / packagecd / package
Download the daemontools-0.76.tar.gz to / package directory to extract the package.
TAR XVZF daemontools-0.76.tar.gzcd admin / daemOLS-0.76
Compile and install the Daemontools program
Package / Install
Second, using the Supervise program for program management monitoring
Supervise's execution command is Supervise Path, where path is a specified path, which can be a relative path or an absolute path. In the Path path, there must be a ruin script, Supervise call is this script and monitors the program running in this script.
An important feature of Supervise is to detect if the programs executed in the run script are working properly. If it is dead, Supervise will re-execute the RUN script and restart the specified program. This is very necessary for many server programs, no one is willing to climb out from the bed at 2 o'clock in the night, restart the server.
Below is an example of simply use Supervise.
Three, examples
Assume that Daemontools have been installed, create a TEST directory, enter the directory
Mkdir testcd test
Write a simple test program in this directory Test.c:
#include
Compile TEST.C output is TEST.
GCC -O Test Test.c
Write a script run to perform the Test program to call Supervise.
#! / bin / shecho "Start Test!" ./ TEST
After retreating to the superior directory, execute Supervise Test to see the effect:
Cd ..supervise test
Execute KILLALL -9 TEST to kill the Test process, you will find that Supervise will restart the Test process. Of course, if the program core dump, Supervise will also restart the program. Here is here, if you use supervise, please tell me, connxu @ 126.com.