Bug#295915: proposed fix
Proposed fix, beware its not been checked for bashisms.
This also adds the check on stop.
--- /etc/init.d/apache2 2005-02-19 03:07:20.000000000 +0100
+++ /etc/init.d/apache2.fixed 2005-02-19 03:02:59.000000000 +0100
@@ -32,7 +32,31 @@
if `apache2 -t > /dev/null 2>&1`; then
# if the config is ok than we just stop normaly
- $APACHE2 -k stop
+ if [ -f /var/run/apache2.pid ]
+ PID=$(cat /var/run/apache2.pid)
+ $APACHE2 -k stop
+ while [ 1 ]
+ CNT=$(expr $CNT + 1)
+ [ ! -d /proc/$PID ] && break
+ if [ $CNT -gt 60 ]
+ echo " ... failed!"
+ echo "Apache2 failed to honor the stop command, please investigate the situation by hand."
+ exit 1
+ sleep 1
# if we are here something is broken and we need to try
# to exit as nice and clean as possible
@@ -105,7 +129,6 @@
restart | force-reload)
echo -n "Forcing reload of web server: Apache2"
- sleep 10