]> granicus.if.org Git - apache/commitdiff
Update the htcacheclean init script to take into account the pid of
authorGraham Leggett <minfrin@apache.org>
Wed, 17 Feb 2010 00:54:21 +0000 (00:54 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 17 Feb 2010 00:54:21 +0000 (00:54 +0000)
the running htcacheclean process. This enables htcacheclean to be
enabled more than once to clean multiple caches on the same machine.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@910791 13f79535-47bb-0310-9956-ffa450edef68

build/rpm/htcacheclean.init

index 1f33f715aac202b756097896a2ebd12614c0c488..8cc57f7b2de2af32d7db238729b1e51bc28952e0 100755 (executable)
 # 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 @@ RETVAL=0
 
 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 @@ start() {
 }
 stop() {
        echo -n $"Stopping $prog: "
-       killproc $htcacheclean
+       killproc -p ${pidfile} $htcacheclean
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile}
@@ -75,7 +79,7 @@ case "$1" in
        stop
        ;;
   status)
-        status $htcacheclean
+        status -p ${pidfile} $htcacheclean
        RETVAL=$?
        ;;
   restart)
@@ -83,7 +87,7 @@ case "$1" in
        start
        ;;
   condrestart)
-       if status $htcacheclean >&/dev/null; then
+       if status -p ${pidfile} $htcacheclean >&/dev/null; then
                stop
                start
        fi