Bug#295915: minor issue in patch
Just noticed a minor issue with the proposed fix, when there is no
pidfile, it does not tell like $APACHE2 -k stop would. So to keep things
somewhat consistent with previous behaviour..
add a else statement for the if [ -f /var/run/apache2.pid ] check..
--- /etc/init.d/apache2 2005-02-19 03:07:20.000000000 +0100
+++ /etc/init.d/apache2.fixed 2005-02-19 04:20:06.000000000 +0100
@@ -32,7 +32,33 @@
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
+ echo " ... no pidfile found! not running?"
# if we are here something is broken and we need to try
# to exit as nice and clean as possible
@@ -105,7 +131,6 @@
restart | force-reload)
echo -n "Forcing reload of web server: Apache2"
- sleep 10