monit-general
[Top][All Lists]
Advanced

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

Re: How to check for a path in a url and restart runit if fails


From: Eric PAILLEAU
Subject: Re: How to check for a path in a url and restart runit if fails
Date: Thu, 12 Apr 2012 15:35:43 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Le 12/04/2012 15:27, David Montgomery a écrit :
When I run apache ab in a t1.micro the site crashes.  This is what I
want.  Its a spawn-fcgi script under control of runit.  I am using
nginx and the unix socket is in /tmp/9002.socket.

But I also want to use monit to bring it back up.  When I go
http://mysite.com/pixel  in FF the page will not load. Even further
the pid still looks alive according to monit.  I get a green light.
When testing local host I still get a green light.  According to monit
the site is still good and the pid is still good so wit will not
restart.   I get no emails alerts and monit loves to send emails:)

I can now restart the service from monit.  But, monit will not
automatically restart the service.  I have tried the following.

check host localhost with address 127.0.0.1
     start program = "/bin/bash -c '/usr/bin/killall pixelServer&&
sleep 2&&  /home/ubuntu/test.sh'"
     stop program = "/usr/bin/sv kill pixelServer"
     if failed url
          http://127.0.0.1:80/pixel
          and timeout 2 seconds
       then exec "/bin/bash -c '/home/ubuntu/test.sh'"
Hi,
Be carefull

/usr/bin/killall pixelServer&&  sleep 2&&  /home/ubuntu/test.sh

Will work only if there is some processes to kill, try

(/usr/bin/killall pixelServer&&  sleep 2 ) ; /home/ubuntu/test.sh

this way the script will be launched if there was process(es) OR NOT.
If there is process(es) to kill , a 2 second sleep wait will be done only if 
some processes was existing,
to let them time to close properly.










reply via email to

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