[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: monit watchdog timer restart
From: |
Martin Pala |
Subject: |
Re: monit watchdog timer restart |
Date: |
Tue, 24 Feb 2004 23:11:58 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040122 Debian/1.6-1 |
Hi, following setup should work in this case:
check process AppManager with pidfile "/var/lxs/run/AppManager.pid"
start program = "/opt/lxs/bin/lxs.sh start AppManager"
stop program = "/opt/lxs/bin/lxs.sh stop AppManager"
check file AppManager_monit with path "/var/lxs/run/AppManager.monit"
if timestamp > 2 minutes then stop
depends on AppManager
Stop events are inherited via dependency, though the depending file-type
service has no stop method defined.
Martin
Peter Holdaway wrote:
Hi,
I would like some advice on the simplest way to implement a watchdog timer
restart of a process. Perhaps this could also be added to the documentation
too.
I have a process that should be regularly updating a file. If it is not I
can assume the process is broken and should be restarted. In the absence of
a network protocol, this is often the easiest way to instrument a process
for monitoring its readiness to perform work.
In version 3.2 of monit this was accomplished by...
check AppManager with pidfile /var/lxs/run/AppManager.pid
start program = "/opt/lxs/bin/lxs.sh start AppManager"
stop program = "/opt/lxs/bin/lxs.sh stop AppManager"
if timestamp "/var/lxs/run/AppManager.monit" > 2 minute then restart
Is the following the best expression of this problem in monit 4.2 ?
check process AppManager with pidfile "/var/lxs/run/AppManager.pid"
start program = "/opt/lxs/bin/lxs.sh start AppManager"
stop program = "/opt/lxs/bin/lxs.sh stop AppManager"
check file AppManager_monit with path "/var/lxs/run/AppManager.monit"
if timestamp > 2 minutes then exec "/opt/lxs/bin/lxs.sh stop AppManager"
depends on AppManager
Notice the unusual direction of the dependency. There do not seem to be any
examples of this in the documentation.
This dependency is required so that when "monit stop AppManager" is issued
then the AppManager_monit service is also stopped.
This solution requires two time periods to restart the process, one for the
timestamp and one for the process restart.
TIA
Peter
--
To unsubscribe:
http://mail.nongnu.org/mailman/listinfo/monit-general