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 2010/02/17 01:54:21 UTC

svn commit: r910791 - /httpd/httpd/trunk/build/rpm/htcacheclean.init

Author: minfrin
Date: Wed Feb 17 00:54:21 2010
New Revision: 910791

URL: http://svn.apache.org/viewvc?rev=910791&view=rev
Log:
Update the htcacheclean init script to take into account the pid of
the running htcacheclean process. This enables htcacheclean to be
enabled more than once to clean multiple caches on the same machine.

Modified:
    httpd/httpd/trunk/build/rpm/htcacheclean.init

Modified: httpd/httpd/trunk/build/rpm/htcacheclean.init
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/build/rpm/htcacheclean.init?rev=910791&r1=910790&r2=910791&view=diff
==============================================================================
--- httpd/httpd/trunk/build/rpm/htcacheclean.init (original)
+++ httpd/httpd/trunk/build/rpm/htcacheclean.init Wed Feb 17 00:54:21 2010
@@ -37,14 +37,18 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-if [ -f /etc/sysconfig/htcacheclean ]; then
-        . /etc/sysconfig/htcacheclean
+# What were we called? Multiple instances of the same daemon can be
+# created by creating suitably named symlinks to this startup script
+prog=`basename $0`
+
+if [ -f /etc/sysconfig/${prog} ]; then
+        . /etc/sysconfig/${prog}
 fi
 
-# Path to the apachectl script, server binary, and short-form for messages.
+# Path to htcacheclean, server binary, and short-form for messages.
 htcacheclean=${HTTPD-/usr/sbin/htcacheclean}
-prog=htcacheclean
-lockfile=${LOCKFILE-/var/lock/subsys/htcacheclean}
+lockfile=${LOCKFILE-/var/lock/subsys/${prog}}
+pidfile=/var/log/httpd/${prog}.pid
 interval=${INTERVAL-10}
 cachepath=${CACHEPATH-/var/cache/httpd/cache-root}
 limit=${LIMIT-100M}
@@ -52,7 +56,7 @@
 
 start() {
         echo -n $"Starting $prog: "
-        daemon $htcacheclean -d "$interval" -p "$cachepath" -l "$limit" $OPTIONS
+        daemon --pidfile=${pidfile} $htcacheclean -d "$interval" -p "$cachepath" -l "$limit" -P "$pidfile" $OPTIONS
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && touch ${lockfile}
@@ -60,7 +64,7 @@
 }
 stop() {
 	echo -n $"Stopping $prog: "
-	killproc $htcacheclean
+	killproc -p ${pidfile} $htcacheclean
 	RETVAL=$?
 	echo
 	[ $RETVAL = 0 ] && rm -f ${lockfile}
@@ -75,7 +79,7 @@
 	stop
 	;;
   status)
-        status $htcacheclean
+        status -p ${pidfile} $htcacheclean
 	RETVAL=$?
 	;;
   restart)
@@ -83,7 +87,7 @@
 	start
 	;;
   condrestart)
-	if status $htcacheclean >&/dev/null; then
+	if status -p ${pidfile} $htcacheclean >&/dev/null; then
 		stop
 		start
 	fi