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: Marc Rossi
Subject: Re: monit doesn't run stop action
Date: Thu, 7 Mar 2019 08:00:51 -0600

Agree on the pidfile stuff (and we have ran into those "somewhat unwanted incidents" by not using them). We usually do but sometimes it is out of my control and you can't fight'em all.

On Tue, Mar 5, 2019 at 3:22 PM SZÉPE Viktor <address@hidden> wrote:
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






--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

reply via email to

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