Monitor and auto restart crond in cpanel/whm
Crond is the cron daemon that is responsible for running the cron tasks of all users on a linux system. Most hosting providers provide it on the servers they sell. Cpanel is a popular server management application that can manage various such daemons and services and restart them if they shut down for some reason. It has a component called 'chkservd' that monitors the services that are included in it and restarts them if they are found offline.
I have a server where some of my applications did important tasks through crond. Recently noticed that cron tasks were not working at all. After a little inspection found that crond was not running at all.
# service crond status crond dead but pid file exists
The temporary solution was to start cron using the service command. But to check whether cron was running or not, the shell had to be opened which was time taking. Had cpanel shown the status of crond
The following steps would show how to configure cpanel so that it shows and monitors the status of crond, and restarts it in the event of a shutdown due to whatever reasons.
# pico /etc/chkserv.d/crond
Add the following line to the file
Save the file and exit. Now check "Service Manager" in whm. It would show an entry for crond. Select enable and monitor for crond and Save.
Now check the status of crond on the Service Status page.