[Top][All Lists]

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

Re: Stop/Start happening simultaneously

From: Cyrus Mehta
Subject: Re: Stop/Start happening simultaneously
Date: Wed, 4 Apr 2007 18:53:52 -0400

I put basic sleep cmds in my start script preventing the bad effects from
simultaneous runs, but I am still not clear on what is happening when I run
the stop command, such that execv thinks the stop command is finished (so
quickly) such that it can continue to run the start script.  The sleep cmd
handles the simultaneous stop/start problem for this set of services, but
we have a number of items I want to monitor that modifying the start/stop
sequences with sleep cmds would be problematic.

My original start/stop script calls were like this
      start = "/mycompany/script/ schedserver start "
      stop = "/mycompany/script/ schedserver stop "

I have since tried:
      start = "/usr/bin/bash -c '/mycompany/script/
schedserver start' "
      stop =  "/usr/bin/bash -c '/mycompany/script/
schedserver stop' "

With no difference.

What is execv looking from the stop command, an exitcode? The PID of the
process it creates to exit?  Basically how do make execv wait from a shell



             <address@hidden                                          To 
             com>                      This is the general mailing list    
             Sent by:                  for monit                           
             monit-general-bou         <address@hidden>          
             nces+cmehta=fnx.c                                          cc 
                                       Re: Stop/Start happening            
             03/30/2007 07:54          simultaneously                      
             Please respond to                                             
                This is the                                                
              general mailing                                              
              list for monit                                               

On 29. mar. 2007, at 23.49, Cyrus Mehta wrote:

> Can I get away with:
>       start = "sleep 60 && /mycompany/script/ schedserver
> start "
> or do I have to do the following:
>       start = "bash -c 'sleep 60 && /mycompany/script/
> schedserver start' "

You need to do the last one. The start command is run through exec
(see man execv), so if you want to do shell-scripting you need to
start a shell. You may also put that sleep call into the top of the instead.

Apropos your previous question about restart. Monit does wait for the
process to stop running before it call the start command. This means
that stop and start does not happen simultaneously, but in sequence
and that the process is truly stopped, i.e. it does not exist in the
process table, before it is started again.

Don't know if you do so in "/mycompany/script/
schedserver stop", but if you take down a process with a kill, system
resources used by the program may need some time to be released in
the kernel. For instance bound socket connections (not using
SO_REUSEADDR) may prevent rebinding a socket to the same port and so
on. Maybe that is the reason you have a  problem getting the program
up again after a monit restart?

To unsubscribe:

reply via email to

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