[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/runService.sh schedserver start "
stop = "/mycompany/script/runService.sh schedserver stop "
I have since tried:
start = "/usr/bin/bash -c '/mycompany/script/runService.sh
schedserver start' "
stop = "/usr/bin/bash -c '/mycompany/script/runService.sh
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
script?
Cyrus
-----------------------------------------------------------------------
Jan-Henrik
Haukeland
<address@hidden To
com> This is the general mailing list
Sent by: for monit
monit-general-bou <address@hidden>
nces+cmehta=fnx.c cc
address@hidden
Subject
Re: Stop/Start happening
03/30/2007 07:54 simultaneously
AM
Please respond to
This is the
general mailing
list for monit
<address@hidden
ngnu.org>
On 29. mar. 2007, at 23.49, Cyrus Mehta wrote:
> Can I get away with:
> start = "sleep 60 && /mycompany/script/runService.sh schedserver
> start "
> or do I have to do the following:
> start = "bash -c 'sleep 60 && /mycompany/script/runService.sh
> 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
runService.sh 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/runService.sh
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:
http://lists.nongnu.org/mailman/listinfo/monit-general
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Stop/Start happening simultaneously,
Cyrus Mehta <=