Soft and hard stop command

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Soft and hard stop command

Maciej Ostaszewski
I need "soft" and "hard" stop command.
Hard stop command will be executed only when stop command does not
work for 3 times.
What is the best method to achieve  this?
Will this work?

check process redis with pidfile /usr/local/redis/redis.pid
    start program = "/usr/local/redis/start.sh" with timeout 60 seconds
    stop program  = "/usr/local/redis/stop.sh"
    if failed host localhost port 6379
        send "PING\n"
        expect "PONG"
    then restart
    if 3 restarts within 3 cycles then exec "killall -9 redis"
    if 6 restart within 6 cycles then timeout

maciek

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Soft and hard stop command

martinp@tildeslash.com
Yes, this should work.

Also note that you can simplify connection test - monit 5.10 and newer have support redis protocol test:

check process redis with pidfile /usr/local/redis/redis.pid
   start program = "/usr/local/redis/start.sh" with timeout 60 seconds
   stop program  = "/usr/local/redis/stop.sh"
   if failed port 6379 protocol redis then restart
   if 3 restarts within 3 cycles then exec "killall -9 redis"
   if 6 restart within 6 cycles then timeout

Regards,
Martin


> On 13 Mar 2015, at 09:35, Maciej Ostaszewski <[hidden email]> wrote:
>
> I need "soft" and "hard" stop command.
> Hard stop command will be executed only when stop command does not
> work for 3 times.
> What is the best method to achieve  this?
> Will this work?
>
> check process redis with pidfile /usr/local/redis/redis.pid
>    start program = "/usr/local/redis/start.sh" with timeout 60 seconds
>    stop program  = "/usr/local/redis/stop.sh"
>    if failed host localhost port 6379
>        send "PING\n"
>        expect "PONG"
>    then restart
>    if 3 restarts within 3 cycles then exec "killall -9 redis"
>    if 6 restart within 6 cycles then timeout
>
> maciek
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general


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