Howto monitor and restart services automatically

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
15
313
Houston, TX
cPanel Access Level
Root Administrator
cPanel and WHM actually has such a script built-in. You can add any service you want to /etc/chkserv.d/chkservd.conf

Chkserv supports two types of monitoring:

1 - Connection based monitoring: Chkserv will send out a request and anticipate an expected response. If it does not receive the expected response, it will attempt to restart the service. The syntax for adding this type of monitoring to chkservd.conf is as follows:

- service[serviceName] = port,send,response,restart
serviceName = Name of service
response = Expected Response
restart = Full path to restart service
send = What data to send

2 - Command based monitoring: Checks to see if a service (command) is running locally. If not, it attempts to restart it.
- service[serviceName] = ,,,restart,command,owner
command is a regular expression

Chkservd will monitor services periodically, once every 8 minutes.
 

jayh38

Well-Known Member
Mar 3, 2006
1,212
0
166
You can easily adjust your basic services via the "service manager" in whm. Check the box on the right of the service you would like monitored.