You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2009/09/11 20:34:42 UTC

svn commit: r813973 - /httpd/httpd/branches/2.2.x/build/rpm/httpd.init

Author: minfrin
Date: Fri Sep 11 18:34:41 2009
New Revision: 813973

URL: http://svn.apache.org/viewvc?rev=813973&view=rev
Log:
Backport of r813972:
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.

Modified:
    httpd/httpd/branches/2.2.x/build/rpm/httpd.init

Modified: httpd/httpd/branches/2.2.x/build/rpm/httpd.init
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/build/rpm/httpd.init?rev=813973&r1=813972&r2=813973&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/build/rpm/httpd.init (original)
+++ httpd/httpd/branches/2.2.x/build/rpm/httpd.init Fri Sep 11 18:34:41 2009
@@ -16,14 +16,24 @@
 # 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 @@
 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 @@
 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 @@
 	stop
 	;;
   status)
-        status $httpd
+        status -p ${pidfile} $httpd
 	RETVAL=$?
 	;;
   restart)
@@ -107,7 +119,7 @@
 	start
 	;;
   condrestart)
-	if [ -f /var/run/httpd.pid ] ; then
+	if status -p ${pidfile} $httpd >&/dev/null; then
 		stop
 		start
 	fi