monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using Monit do restart cron


From: Martin Pala
Subject: Re: using Monit do restart cron
Date: Fri, 17 Aug 2012 18:54:39 +0200

Hello,

the test which you have is correct to restart cron if it isn't running (crashed or was stopped).

In the case that the cron process is running, but not executing the tasks, you can add for example some cronjob, which will touch some file to signalise, that the tasks are executed, and then set monit, to check that the timestamp is updated … if the task is run every 5 minutes, you can use something like this:

--8<--
check file cron_test with path /tmp/monit_cron_test
    if timestamp > 6 minutes then exec "/usr/bin/monit restart cron"
--8<--

and the cronjob:
--8<--
*/5 * * * * /usr/bin/touch /tmp/monit_cron_test
--8<--

Regards,
Martin


On Aug 17, 2012, at 5:16 PM, "Alexandre Carlos Vilarinho de Oliveira" <address@hidden> wrote:

Hello all,
 
Is it possible to configure monit to restart CRON if it stop working for some reason?
 
Currently I´m using the following configuration to monitor it, but monit do not restart it.
 
check process cron with pidfile /var/run/cron.pid
   group system
   start program = "/etc/init.d/cron start"
   stop  program = "/etc/init.d/cron stop"
   if 5 restarts within 5 cycles then timeout
   depends on cron_rc
 
check file cron_rc with path /etc/init.d/cron
   group system
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor
 
Regards
 
Atenciosamente
 
Alexandre Vilarinho 
Gerente de Engenharia de Rede IP/TI 
Tel.: (55 11) 3017-4683
Cel.: (55 11) 7757-8388
Fax: (55 11) 3017-4464

address@hidden
 
www.neovia.com.br 
----------------------------
<image001.gif>
 
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

[Prev in Thread] Current Thread [Next in Thread]