{"id":950,"date":"2010-06-29T13:43:30","date_gmt":"2010-06-29T17:43:30","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=950"},"modified":"2013-03-20T08:42:47","modified_gmt":"2013-03-20T12:42:47","slug":"how-to-monitor-and-auto-restart-cron-service-using-cpanel-chkservd","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-monitor-and-auto-restart-cron-service-using-cpanel-chkservd","title":{"rendered":"How to monitor and auto restart cron service using cPanel chkservd?"},"content":{"rendered":"<p><strong><strong>Sometimes it is necessary to monitor a crond service itself on a cPanel server. <\/strong><\/strong>cPanel offers &#8216;chkservd&#8217; (a monitoring daemon) that monitors the services that are included in it and restarts them if they are found offline.<\/p>\n<p>However, cPanel do not provide an option to include the &#8216;crond&#8217; service under chkservd. The following method can be used to add crond service under chkservd.<\/p>\n<p>Create a crond file under the chkservd.d directory where the files of all the services are placed:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># pico \/etc\/chkserv.d\/crond<\/span><\/pre>\n<\/blockquote>\n<p>Add the following and save the file:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">service[crond]=x,x,x,\/etc\/init.d\/crond restart,crond,root<\/span><\/pre>\n<\/blockquote>\n<p>Now you need to edit the chkservd configuration file and enable the crond service for monitoring<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># pico \/etc\/chkserv.d\/chkservd.conf<\/span><\/pre>\n<\/blockquote>\n<p>add the following line at the end of the file<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">crond:1<\/span><\/pre>\n<\/blockquote>\n<p>Now, save the file and restart the chkservd service for the new changes to take affect:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># \/scripts\/restartsrv chkservd<\/span><\/pre>\n<\/blockquote>\n<p>In order to verify if chkservd auto-restarts the crond service if it is offline, stop the service manually<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># service crond stop<\/span><\/pre>\n<\/blockquote>\n<p>and watch the chkservd logs<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># tail -f \/var\/log\/chkservd.log<\/span><\/pre>\n<\/blockquote>\n<p>You will notice that the crond service is restarted automatically within 5 minutes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes it is necessary to monitor a crond service itself on a cPanel server. cPanel offers &#8216;chkservd&#8217; (a monitoring daemon) that monitors the services that are included in it and restarts them if they are found offline.<br \/>\nHowever, cPanel do not provide an option to include the &#8216;crond&#8217; service under chkservd. The following method can be used to add crond service under chkservd.<br \/>\nCreate a crond file under the chkservd.d directory where the files of all the services are placed:<\/p>\n<p># pico \/etc\/chkserv.d\/crond<\/p>\n<p>Add the following and save the file:<\/p>\n<p>service[crond]=x,x,x,\/etc\/init.d\/crond restart,crond,root<\/p>\n<p>Now you [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[914,912,909,910,913,911,908,915,916],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/950"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=950"}],"version-history":[{"count":7,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/950\/revisions"}],"predecessor-version":[{"id":2197,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/950\/revisions\/2197"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}