If the check script fails, have it kill
the program. Then the program check will notice it's not running
and restart it.
Or you can write everything into one
-- Noel Jones
On 10/9/2018 1:05 PM, Steven
I see what you mean.
But if check_xyzzy fails, how can I cause xyzzy to be
restarted? I don't know of any way to have one check cause
another check to be restarted.
I was thinking more, and this may not be solvable with
separate check statements.
I may have to combine both the checking of the process and
checking of the actual functioning of the feature in a single
unified script, like this:
check program xyzzy with path "/root/check_xyzzy.sh"
start program "/root/start_xyzzy.sh"
stop program /usr/bin/pkill -f "xyzzy"
if status != 0 then restart
where check_xyzzy.sh checks 2 things:
1) ps -ef | fgrep "xyzzy" -- to make sure the
2) check the function that xyzzy provides, to make sure
the function is working
It would return a bad status if either of these fails.
have it backwards. check_xyzzy depends on xyzzy.
run the process, then run the script to see if the
process is working.
10/8/2018 6:08 PM, Steven Christensen wrote:
Thank you for your examples. You have a
very complex monit configuration, and I can
learn a lot.
However, I tried the "depends"
implementation, but it did not work when
trying to start the service.
If my "xyzzy" service depends on
"check_xyzzy" then it will not be able to
start, because before xyzzy is able to start.
monit wants check_xyzzy to work, but
check_xyzzy doesn't succeed, because xyzzy
isn't running. It is a "chicken and egg"