From 145d5fab1a950e0b2d1bbd899c70ba8366babfec Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 2 Jan 2010 17:07:47 +0000 Subject: Improve function to detect apache2 pid in init-script (closes: #562583). git-svn-id: svn+ssh://svn.debian.org/svn/pkg-apache/trunk/apache2@1110 01b336ce-410b-0410-9a02-a0e7f243c266 --- debian/apache2.2-common.apache2.init | 26 ++++++++------------------ debian/changelog | 1 + 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/debian/apache2.2-common.apache2.init b/debian/apache2.2-common.apache2.init index 04ba23f1..5982d6ba 100644 --- a/debian/apache2.2-common.apache2.init +++ b/debian/apache2.2-common.apache2.init @@ -71,24 +71,14 @@ stop_htcacheclean() { } 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() { diff --git a/debian/changelog b/debian/changelog index 6f69be80..297ca728 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ apache2 (2.2.14-5) UNRELEASED; urgency=low * 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 Sat, 02 Jan 2010 17:41:40 +0100 -- cgit v1.2.3