monit-general
[Top][All Lists]
Advanced

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

Re: monit doesn't run stop action


From: SZÉPE Viktor
Subject: Re: monit doesn't run stop action
Date: Tue, 05 Mar 2019 22:21:41 +0100
User-agent: Horde Application Framework 5

Idézem/Quoting Marc Rossi <address@hidden>:

Yeah was looking through the code and saw the call to check if process is
running before issuing stop (ProcessTree_findProcess), so that was only
thought I had as well.

check process foo matching /usr/local/bin/foo.py
      start program = "/bin/bash -l -c 'nohup /usr/local/bin/foo.py &'" as
uid "nobody"
      stop program = "/usr/bin/pkill -u nobody -f /usr/local/bin/foo.py" as
uid "nobody"
      if uptime > 11 hours then alert
      if uptime > 12 hours then exec "/usr/bin/pkill -u nobody -f -9
/usr/local/bin/foo.py" as uid "nobody"
      if 2 restarts within 3 cycles then timeout
      group apps
      depends foo.py

check process bar matching ^/usr/local/bin/bar
      start program = "/bin/bash -lc 'HOME=/home/someuser nohup
/usr/local/bin/bar.sh > /tmp/bar-startup.out 2>&1 &'"
      stop program = "/bin/bash -c '/usr/bin/pkill -f ^/usr/local/bin/bar;
sleep 1; /usr/bin/pkill -f ^/usr/local/bin/bar'"
      onreboot nostart
      if uptime > 12 hours then exec "/usr/bin/pkill -9 -f
^/usr/local/bin/bar"
      group apps
      mode passive

BTW it is highly dangerous to run pid file-less and interpreted software with Monit as you may meet some unwanted incidents

Try implementing a pid file in your scripts.

All the best!


SZÉPE Viktor, webes alkalmazás üzemeltetés / Running your application
https://github.com/szepeviktor/debian-server-tools/blob/master/CV.md
~~~
ügyelet/hotline: +36-20-4242498  address@hidden  skype: szepe.viktor
Budapest, III. kerület








reply via email to

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