Is there anyway to monitor crond?

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
A hosted customer just pointed out to us that their crons had not run since Dec 8th. I was amazed to find that crond had stopped on the server without our receiving any sort of notice. We may have received an email about this, but we, like many receive a TON of email every day and this may have been overlooked.

Is there any way to have crond monitored via the Service Manager so that the stats appears when clicking on he Server Status link in WHM?

Thanks much for any answer on this.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,453
31
473
Go on, have a guess
I was told a while back that this was going to be put into chkservd, but it never materialised - possibly because of the different cron daemons used by RH/trustix/FreeBSD. If you want to hack in your own process check it should be straightforward enough if you know some perl and look in the files in /etc/chkserv.d/ and the script itself /usr/local/cpanel/libexec/chkservd
 

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
Trying to write a script for this for chkserv monitoring and restarting cron (when needed).

How does this look:

cd /etc/chkserv.d
touch crond
pico -w crond

Inserting this line at the top:
service[crond]=x,x,x,service crond restart,crond,root|mailnull

Then:
pico -w chkservd.conf

Inserting this line in alpehbetical order within the list:

crond:1


Look good?

Thanks much.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,453
31
473
Go on, have a guess
Looks good - simple to test it. You probably don't need the |mailnull at the end of the line.

This would need tweaking for the likes of FreeBSD and Trustix that use different cron daemons and start methods.
 

jondolar

Well-Known Member
Feb 15, 2004
46
0
156
This works

This worked for me. Remember to restart chkservd

service chkservd restart

Not sure if that is required to restart but once I did that it automatically restarted crond so I know it works now.

Thanks