How to add services to the Service Monitor?

spaceman

Well-Known Member
Mar 25, 2002
517
8
318
Hi,

I've got some payment gateway merchant server software installed on my redhat linux 7.2 machine running latest versions of WHM+cPanel.

This merchant server software needs to be running all the time (obviously) if it's always going to be available to process online payments from the various websites that use it.

How do I

a) Ensure that when (for whatever reason) my machine is restarted that the merchant server software is always started up along with all the other essential services, and
b) Ensure that if (for any reason) the merchant software stops, then this failure is detected and the system attempts to 'automagicaly' restart it (and keeps on attempting/reporting until it does).

I'm not sure if this is entirely a command line thing (which is fine) or whether some or all of it can be achieved via WHM.

Thanks for any help or guidance. This is probably a bit of a newbie question for more experienced webserver admins.
 

jphilipson

Well-Known Member
Jan 8, 2003
80
0
156
YOu can add it to the checkservd by adding a file for it in /etc/chkserv.d/

you can look at the files in thier to get an idea of the format, but its basically ..

#SERVICE = PORT, SEND, RESPONSE, RESTART COMMAND

so would possibly be something likethis (assuming it is running as a service)

service[gateway]=x,x,x,/path/to/command/tostartgateway
 

spaceman

Well-Known Member
Mar 25, 2002
517
8
318
At the risk of straining the friendship :), is there a way of testing a new file that I put in /etc/chkserv.d/ without actually rebooting the server and/or stopping the service in question?

Also, assuming that I've correctly adding a new file in /etc/chkserv.d/, what are the characteristics of the chkserv daemon? For example, does it regularly check that the service in question is running (if so, how often) and attempts to re-start it if not - or does it only kick-in a server restart?

Thanks - your guidance is very much appreciated.
 

jphilipson

Well-Known Member
Jan 8, 2003
80
0
156
the checkservd runs every five minutes.. so kill the gateway script, then wait +/- 5 minutes and see if it gets restarted

but if you leave the PORT, SEND and RESPONSE feilds blank, t won't test to see if its running, it will just restart the program
 

spaceman

Well-Known Member
Mar 25, 2002
517
8
318
Brilliant! Thanks mate, you've been really helpful.

P.S. Merry Xmas from Perth, Australia! It should be in high 30s celsius for Xmas Day so a white christmas looks unlikely :)
 

spaceman

Well-Known Member
Mar 25, 2002
517
8
318
I've just noticed this directory:

/etc/chkserv.d/not/

What's the signficance of the 'not' directory within the chkserv.d directory?

For example, both these files have the same content:

/etc/chkserv.d/proftpd
/etc/chkserv.d/not/proftpd

Thanks.