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 @@
apache_stop() {
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 ]
+ then
+ PID=$(cat /var/run/apache2.pid)
+
+ $APACHE2 -k stop
+
+ CNT=0
+ while [ 1 ]
+ do
+ CNT=$(expr $CNT + 1)
+
+ [ ! -d /proc/$PID ] && break
+
+ if [ $CNT -gt 60 ]
+ then
+ echo " ... failed!"
+ echo "Apache2 failed to honor the stop command, please investigate the situation by hand."
+ exit 1
+ fi
+
+ sleep 1
+ done
+ else
+ echo " ... no pidfile found! not running?"
+ fi
+
else
# 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"
apache_stop
- sleep 10
$APACHE2CTL startssl
echo "."
;;
Reply to: