summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Fritsch <sf@debian.org>2010-01-02 17:07:47 +0000
committerStefan Fritsch <sf@sfritsch.de>2012-01-02 10:37:05 +0100
commit145d5fab1a950e0b2d1bbd899c70ba8366babfec (patch)
tree5ee6b388a55b4ecbbddcd289d41267d31e684689
parent21e2e929a6f9f150f91ffc4e26e3fc378e7cbe57 (diff)
downloadapache2-145d5fab1a950e0b2d1bbd899c70ba8366babfec.tar.gz
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
-rw-r--r--debian/apache2.2-common.apache2.init26
-rw-r--r--debian/changelog1
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 <sf@debian.org> Sat, 02 Jan 2010 17:41:40 +0100