Re: monit doesn't run stop action
SZÉPE Viktor <[email protected]>
| Newsgroups | gmane.comp.monitoring.monit.general |
|---|---|
| Message-ID | <[email protected]> |
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