monit-general
[Top][All Lists]
Advanced

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

Re: how to stop monitoring a service when you stop it manually


From: Martin Pala
Subject: Re: how to stop monitoring a service when you stop it manually
Date: Sun, 09 Apr 2006 11:33:07 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1

Mike Pepe wrote:
Hi all,

I've just got monit up and running on my fedora core 3 system. So far it seems to be running just fine.

I wanted to make sure that monit won't start a service that's been manually shutdown. Services that have been stopped manually/cleanly would be missing their lockfile. So I added a dependency such that if the lockfile is missing, the service should be unmonitored. such as this:

check process freshclam with pidfile /var/run/clamav/freshclam.pid
   group freshclam
   start program = "/etc/init.d/freshclam start"
   stop  program = "/etc/init.d/freshclam stop"
   if 5 restarts within 5 cycles then timeout
   depends on freshclam_lock
   depends on clamd

check file freshclam_lock with path /var/lock/subsys/freshclam
   group freshclam
   if failed uid root then unmonitor
   if failed gid root then unmonitor

but, it doesn't do what I expect.

Sorry about the n00b question, but what am I doing wrong? I'm assuming that if the file is missing that the gid/uid check will fail- perhaps there's a better way to do that too.


The file test performs the existence check first - in the case that the file doesn't exist, monit will perform the existence related action and will not check the other file properties in this cycle (it makes no sense to test e.g. uid in the case that the object doesn't exist).

To gracefuly stop the process which is under monit's control, you should use 'monit stop freshclam' - monit will stop the process and disable its monitoring. This should be used even in scripts such as logrotate, etc.

Martin











reply via email to

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