Bug#479136: apache2: Please don't use "sleep 10" for "restart", but wait until Apache has gone away (with timeout)
On Saturday 03 May 2008 13:13:20 Stefan Fritsch wrote:
> On Saturday 03 May 2008, Daniel Hahler wrote:
> > The apache2 init script uses "sleep 10", after "stop" before
> > calling "start".
> > Please "just" wait until Apache has gone away.
> > This has two benefits:
> > - No fixed downtime of 10 seconds (often Apache can be restarted
> > much quicker)
> The 10 seconds can probably be shortened. But the problem ist that
> there is no guarantee that the children have closed their listening
> sockets when the parent process dies. Just waiting until the parent
> disappears could cause an error when starting the new apache (e.g.
> when a child process is swapped out to disk).
So we need parent to die only when all children have died? Isn't it
apache bug then?
10 seconds sleep is really unfriendly. You could make this at least
configurable in /etc/default/apache2
And in 'else' case like this:
if ! apache_stop; then
log_end_msg 1 || true
Because there is no need to delay when there is no apache running.