Monitor and auto restart crond in cpanel/whm

By | June 9, 2013

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

service[crond]=x,x,x,/etc/init.d/crond restart,crond,root

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.

crond_service_manager

Now check the status of crond on the Service Status page.

crond_service_status

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *