|From:||Alexandre Carlos Vilarinho de Oliveira|
|Subject:||RES: using Monit do restart cron|
|Date:||Tue, 21 Aug 2012 15:11:27 -0300|
Thank you very much for your help, but I´ve changed a little bit monit´s configuration. Follow the conf I´ve used.
# monitorando arquivo temporario monit/cron
check file cron_test with path /etc/monit/monit.test
if timestamp > 5 minutes then exec "/etc/init.d/cron restart"
Now if there is any problem with cron and it stops working for some reason monit will restart it automatically.
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:
check file cron_test with path /tmp/monit_cron_test
if timestamp > 6 minutes then exec "/usr/bin/monit restart cron"
and the cronjob:
*/5 * * * * /usr/bin/touch /tmp/monit_cron_test
On Aug 17, 2012, at 5:16 PM, "Alexandre Carlos Vilarinho de Oliveira" <address@hidden> wrote:
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
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
if failed checksum then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
|[Prev in Thread]||Current Thread||[Next in Thread]|