Answer the question
In order to leave comments, you need to log in
Does Apache take too long to restart?
The stop is done by the following script:
PID=`cat /var/run/apache2.pid`<br/>
kill -TERM $PID<br/>
if [ -n "${PID:-}" ]; then<br/>
i=0<br/>
while kill -0 "${PID:-}" 2> /dev/null; do<br/>
if [ $i = '60' ]; then<br/>
break;<br/>
else<br/>
if [ $i = '0' ]; then<br/>
echo -n " waiting "<br/>
else<br/>
echo -n "."<br/>
fi<br/>
i=$(($i+1))<br/>
sleep 1<br/>
fi<br/>
done<br/>
fi
(98)Address already in use: make_sock: could not bind to address 127.0.0.1:80<br/>
no listening sockets available, shutting down<br/>
Unable to open logs
kill -TERM `cat /var/run/nginx/nginx.pid`
Answer the question
In order to leave comments, you need to log in
The script works "without waiting (does not draw dots)" - because it is crookedly written.
while kill -0 "${PID:-}" 2> /dev/null; do
will always be FALSE when the process is running, because kill -0 returns 0 (i.e. false) if the process can be signaled.
If you rewrite the script to something like this, then it will wait for the process to complete:
Next, you should check who exactly occupies the socket and what state it is in, for example netstat -anptl | grep 127.0.0.1:80
And dance further from this (well, no one forbade watching the logs during the stop).
kill -0 ${PID:-}
while [ $? -eq 0 ]; do
.....
kill -0 ${PID:-}
done;
And if you try apache2ctl stop or apache2ctl -k stop?
Those. stop work not through kill.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question