]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport of r813972:
authorGraham Leggett <minfrin@apache.org>
Fri, 11 Sep 2009 18:34:41 +0000 (18:34 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 11 Sep 2009 18:34:41 +0000 (18:34 +0000)
Fix the RPM init.d script to correctly take into account the pid file
when starting and stopping the server. This prevents the init script
from blowing away other instances of httpd that might be running on the
same machine when someone attempts to stop the server.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@813973 13f79535-47bb-0310-9956-ffa450edef68

build/rpm/httpd.init

index be9c2e16bc5bac30c306c60e49975435e006e77a..535212702742b2487b926e1f291c780106c0ec75 100755 (executable)
 # limitations under the License.
 #
 #
-# Startup script for the Apache Web Server
+# httpd        Startup script for the Apache Web Server
 #
 # chkconfig: - 85 15
-# description: Apache is a World Wide Web server.  It is used to serve \
-#             HTML files and CGI.
+# description: The Apache HTTP Server is an efficient and extensible  \
+#             server implementing the current HTTP standards.
 # processname: httpd
-# pidfile: /var/run/httpd.pid
-# config: /etc/httpd/conf/httpd.conf
+# pidfile: /var/log/httpd/httpd.pid
+# config: /etc/sysconfig/httpd
+#
+### BEGIN INIT INFO
+# Provides: httpd
+# Required-Start: $local_fs $remote_fs $network $named
+# Required-Stop: $local_fs $remote_fs $network
+# Should-Start: distcache
+# Short-Description: start and stop Apache HTTP Server
+# Description: The Apache HTTP Server is an extensible server 
+#  implementing the current HTTP standards.
+### END INIT INFO
 
 # Source function library.
 . /etc/rc.d/init.d/functions
@@ -44,6 +54,8 @@ INITLOG_ARGS=""
 apachectl=/usr/sbin/apachectl
 httpd=${HTTPD-/usr/sbin/httpd}
 prog=httpd
+pidfile=${PIDFILE-/var/log/httpd/httpd.pid}
+lockfile=${LOCKFILE-/var/lock/subsys/httpd}
 RETVAL=0
 
 # check for 1.3 configuration
@@ -69,23 +81,23 @@ check13 () {
 start() {
         echo -n $"Starting $prog: "
         check13 || exit 1
-        daemon $httpd $OPTIONS
+        daemon --pidfile=${pidfile} $httpd $OPTIONS
         RETVAL=$?
         echo
-        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
+        [ $RETVAL = 0 ] && touch ${lockfile}
         return $RETVAL
 }
 stop() {
        echo -n $"Stopping $prog: "
-       killproc $httpd
+       killproc -p ${pidfile} $httpd
        RETVAL=$?
        echo
-       [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
+       [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
 }
 reload() {
        echo -n $"Reloading $prog: "
        check13 || exit 1
-       killproc $httpd -HUP
+       killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
        echo
 }
@@ -99,7 +111,7 @@ case "$1" in
        stop
        ;;
   status)
-        status $httpd
+        status -p ${pidfile} $httpd
        RETVAL=$?
        ;;
   restart)
@@ -107,7 +119,7 @@ case "$1" in
        start
        ;;
   condrestart)
-       if [ -f /var/run/httpd.pid ] ; then
+       if status -p ${pidfile} $httpd >&/dev/null; then
                stop
                start
        fi