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: Callum Macdonald
Subject: Re: How to check for a path in a url and restart runit if fails
Date: Wed, 11 Apr 2012 23:54:36 +0000

I think rather than exec you want just restart, that will have the
effect of restarting the service. So something like:

if failed host 127.0.0.1 port 80 protocol http
  request /pixel
  hostheader 'my.webserver.name'
  then restart

I believe this is far more elegant than repeating the restart commands
in each exec statement, but I might have missed something, it's late in
this timezone! :-)

Cheers - Callum.

PS> Hope this hits the list only once, accidentally posted from the
wrong email again, DOH.

On Wed, 2012-04-11 at 16:38 -0500, Noel wrote:
> If you need to exec multiple commands, put them in a little shell
> script and exec the shell script.
> 
> 
> 
> 
> On 4/11/2012 4:04 PM, David Montgomery wrote:
> > when I used an exec command can I do this? then exec "sv kill
> > pixelServer;sv up pixelServer"  i.e. execute "sv kill pixelServer"
> > then   "sv start pixelServer".  If not then what is best practice to
> > executing two command?
> >
> > Thanks
> >
> > On Thu, Apr 12, 2012 at 3:22 AM, Noel <address@hidden> wrote:
> >> if failed host 127.0.0.1 port 80 protocol http
> >>  request /pixel
> >>  hostheader 'my.webserver.name'
> >>  then exec ...
> >>
> >> You may or may not need the hostheader parameter; leave it out if
> >> you don't need it.
> >>
> >>
> >>
> >>
> >> On 4/11/2012 2:05 PM, David Montgomery wrote:
> >>> I have proccess aka cgi scrips for each path e.g. localhost/path1
> >>> localhost/path2 etc
> >>>
> >>> I dont want to restart for all
> >>>
> >>> On Thu, Apr 12, 2012 at 2:49 AM, Wayne Lawrence
> >>> <address@hidden> wrote:
> >>>> Hi David,
> >>>>
> >>>> I think you could simplify this a lot with the following
> >>>>
> >>>> If failed port 80 protocol http then restart
> >>>>
> >>>> That should do what you require as I believe if you don't specify a
> >>>> host it defaults to local host
> >>>>
> >>>> Regards
> >>>>
> >>>> Wayne
> >>>>
> >>>> Sent from my iPhone
> >>>>
> >>>> On 11 Apr 2012, at 19:44, David Montgomery <address@hidden> wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I am trying to stress test my server.
> >>>>>
> >>>>> I have a process under the control of monit and runit.
> >>>>>
> >>>>> Here is my monit config file for the process
> >>>>>
> >>>>> check process pixelServer
> >>>>>   with pidfile "/etc/sv/pixelServer/supervise/pid"
> >>>>>   start program = "/usr/bin/sv up pixelServer"
> >>>>>   stop program = "/usr/bin/sv kill pixelServer"
> >>>>>   if failed host 127.0.0.1/pixel port 80 protocol HTTP then exec "sv
> >>>>> up pixelServer"
> >>>>>   depends on nginx.
> >>>>>
> >>>>> Here is the log....
> >>>>>
> >>>>> I am checking process every 10 seconds.
> >>>>>
> >>>>> [UTC Apr 11 18:29:37] error    : Error: Could not execute sv
> >>>>> [UTC Apr 11 18:29:47] error    : 'pixelServer' failed, cannot open a
> >>>>> connection to INET[127.0.0.1/pixel:80] via TCP
> >>>>> [UTC Apr 11 18:29:47] info     : 'pixelServer' exec: sv
> >>>>> [UTC Apr 11 18:29:47] error    : Error: Could not execute sv
> >>>>> [UTC Apr 11 18:29:57] error    : 'pixelServer' failed, cannot open a
> >>>>> connection to INET[127.0.0.1/pixel:80] via TCP
> >>>>> [UTC Apr 11 18:29:57] info     : 'pixelServer' exec: sv
> >>>>> [UTC Apr 11 18:29:57] error    : Error: Could not execute sv
> >>>>> [UTC Apr 11 18:30:08] error    : 'pixelServer' failed, cannot open a
> >>>>> connection to INET[127.0.0.1/pixel:80] via TCP
> >>>>> [UTC Apr 11 18:30:08] info     : 'pixelServer' exec: sv
> >>>>> [UTC Apr 11 18:30:08] error    : Error: Could not execute sv
> >>>>> [UTC Apr 11 18:30:19] error    : 'pixelServer' failed, cannot open a
> >>>>> connection to INET[127.0.0.1/pixel:80] via TCP
> >>>>> [UTC Apr 11 18:30:19] info     : 'pixelServer' exec: sv
> >>>>> [UTC Apr 11 18:30:19] error    : Error: Could not execute sv
> >>>>>
> >>>>> Clearly 127.0.0.1/pixel:80 is not a proper path.  How do I check the
> >>>>> path?  Even furher..can I use query strings?
> >>>>>
> >>>>> --
> >>>>> To unsubscribe:
> >>>>> https://lists.nongnu.org/mailman/listinfo/monit-general
> >>>> --
> >>>> To unsubscribe:
> >>>> https://lists.nongnu.org/mailman/listinfo/monit-general
> >>> --
> >>> To unsubscribe:
> >>> https://lists.nongnu.org/mailman/listinfo/monit-general
> >>
> >> --
> >> To unsubscribe:
> >> https://lists.nongnu.org/mailman/listinfo/monit-general
> > --
> > To unsubscribe:
> > https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

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