Re: monit doesn't run stop action

Marc Rossi <[email protected]>
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <CAMJu8UanhJpYGePnHU8+caf2_-0YG44gGJfkOrQVy7dO+52AsQ@mail.gmail.com>
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 <[email protected]> wrote:

> Idézem/Quoting Marc Rossi <[email protected]>:
>
> > 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  [email protected]  skype: szepe.viktor
> Budapest, III. kerület
>
>
>
>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

-- 
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.