[Pkg-apache-commits] r1110 - in /trunk/apache2: apache2.2-common.apache2.init changelog

sf at alioth.debian.org sf at alioth.debian.org
Sat Jan 2 17:07:47 UTC 2010


Author: sf
Date: Sat Jan  2 17:07:47 2010
New Revision: 1110

URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1110
Log:
Improve function to detect apache2 pid in init-script (closes: #562583).

Modified:
    trunk/apache2/apache2.2-common.apache2.init
    trunk/apache2/changelog

Modified: trunk/apache2/apache2.2-common.apache2.init
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/apache2.2-common.apache2.init?rev=1110&op=diff
==============================================================================
--- trunk/apache2/apache2.2-common.apache2.init (original)
+++ trunk/apache2/apache2.2-common.apache2.init Sat Jan  2 17:07:47 2010
@@ -71,24 +71,14 @@
 }
 
 pidof_apache() {
-    # if pidof is null for some reasons the script exits automagically
-    # classified as good/unknown feature
-    PIDS=$(pidof apache2) || true
-
-    [ -e $PIDFILE ] && PIDS2=$(cat $PIDFILE)
-    
-    # if there is a pid we need to verify that belongs to apache2
-    # for real
-    for i in $PIDS; do
-    	if [ "$i" = "$PIDS2" ]; then
-            # in this case the pid stored in the
-            # pidfile matches one of the pidof apache
-            # so a simple kill will make it
-            echo $i
-            return 0
-        fi
-    done
-    return 1
+	# if there is actually an apache2 process whose pid is in PIDFILE,
+	# print it and return 0.
+	if [ -e "$PIDFILE" ]; then
+		if pidof apache2 | tr ' ' '\n' | grep $(cat $PIDFILE); then
+			return 0
+		fi
+	fi
+	return 1
 }
 
 apache_stop() {

Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1110&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Sat Jan  2 17:07:47 2010
@@ -3,6 +3,7 @@
   * Print a useful error message if 'apache2ctl status' fails. Add a comment
     to /etc/apache2/envvars on how to change the options for www-browser.
     Closes: #561496, #272069
+  * Improve function to detect apache2 pid in init-script (closes: #562583).
   * Point to README.backtrace in apache2-dbg's description.
 
  -- Stefan Fritsch <sf at debian.org>  Sat, 02 Jan 2010 17:41:40 +0100




More information about the Pkg-apache-commits mailing list