|
|
af9b8b |
#!/bin/bash
|
|
|
af9b8b |
#
|
|
|
af9b8b |
# htcacheclean Startup script for the htcacheclean
|
|
|
af9b8b |
#
|
|
|
af9b8b |
# chkconfig: - 85 15
|
|
|
af9b8b |
# description: Htcacheclean is used to keep the size of \
|
|
|
af9b8b |
# mod_cache_disk's storage within a given size limit.
|
|
|
af9b8b |
# processname: htcacheclean
|
|
|
af9b8b |
# config: $sysconfdir/sysconfig/htcacheclean
|
|
|
af9b8b |
# pidfile: $localstatedir/run/htcacheclean/htcacheclean.pid
|
|
|
af9b8b |
#
|
|
|
af9b8b |
### BEGIN INIT INFO
|
|
|
af9b8b |
# Provides: htcacheclean
|
|
|
af9b8b |
# Required-Start: $local_fs $remote_fs $named
|
|
|
af9b8b |
# Required-Stop: $local_fs $remote_fs
|
|
|
af9b8b |
# Short-Description: start and stop htcacheclean
|
|
|
af9b8b |
# Description: Htcacheclean is used to keep the size of \
|
|
|
af9b8b |
# mod_cache_disk's storage within a given size limit.
|
|
|
af9b8b |
### END INIT INFO
|
|
|
af9b8b |
|
|
|
af9b8b |
# Source function library.
|
|
|
af9b8b |
. /etc/rc.d/init.d/functions
|
|
|
af9b8b |
|
|
|
af9b8b |
# INTERVAL, CACHE_ROOT and CACHE_LIMIT can be set
|
|
|
af9b8b |
# in $sysconfdir/sysconfig/htcacheclean configuration file.
|
|
|
af9b8b |
if [ -f $sysconfdir/sysconfig/htcacheclean ]; then
|
|
|
af9b8b |
. $sysconfdir/sysconfig/htcacheclean
|
|
|
af9b8b |
fi
|
|
|
af9b8b |
|
|
|
af9b8b |
# Path to the htcacheclean binary.
|
|
|
af9b8b |
binary=$sbindir/htcacheclean
|
|
|
af9b8b |
prog=htcacheclean
|
|
|
af9b8b |
#pidfile=${PIDFILE-/var/run/htcacheclean/htcacheclean.pid}
|
|
|
af9b8b |
lockfile=${LOCKFILE-$localstatedir/lock/subsys/htcacheclean}
|
|
|
af9b8b |
interval=${INTERVAL-5}
|
|
|
af9b8b |
cache_path=${CACHE_ROOT-$localstatedir/cache/mod_proxy}
|
|
|
af9b8b |
cache_limit=${CACHE_LIMIT-150M}
|
|
|
af9b8b |
RETVAL=0
|
|
|
af9b8b |
|
|
|
af9b8b |
start() {
|
|
|
af9b8b |
[ "$EUID" != "0" ] && exit 4
|
|
|
af9b8b |
echo -n $"Starting $prog: "
|
|
|
af9b8b |
daemon $binary -d${interval} -n -i -p${cache_path} -l${cache_limit} $OPTIONS
|
|
|
af9b8b |
RETVAL=$?
|
|
|
af9b8b |
echo
|
|
|
af9b8b |
[ $RETVAL = 0 ] && touch ${lockfile}
|
|
|
af9b8b |
return $RETVAL
|
|
|
af9b8b |
}
|
|
|
af9b8b |
|
|
|
af9b8b |
stop() {
|
|
|
af9b8b |
[ "$EUID" != "0" ] && exit 4
|
|
|
af9b8b |
echo -n $"Stopping $prog: "
|
|
|
af9b8b |
killproc $binary
|
|
|
af9b8b |
RETVAL=$?
|
|
|
af9b8b |
echo
|
|
|
af9b8b |
[ $RETVAL = 0 ] && rm -f ${lockfile}
|
|
|
af9b8b |
}
|
|
|
af9b8b |
|
|
|
af9b8b |
# See how we were called.
|
|
|
af9b8b |
case "$1" in
|
|
|
af9b8b |
start)
|
|
|
af9b8b |
start
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
stop)
|
|
|
af9b8b |
stop
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
status)
|
|
|
f0c688 |
# `status' checks lockfile only in /var/lock/subsys by default.
|
|
|
f0c688 |
# To workaround that, move outside that directory first.
|
|
|
f0c688 |
status -l ../../../${lockfile} $binary
|
|
|
af9b8b |
RETVAL=$?
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
restart)
|
|
|
af9b8b |
stop
|
|
|
af9b8b |
start
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
condrestart|try-restart)
|
|
|
f0c688 |
# `status' checks lockfile only in /var/lock/subsys by default.
|
|
|
f0c688 |
# To workaround that, move outside that directory first.
|
|
|
f0c688 |
if status -l ../../../${lockfile} $binary >&/dev/null; then
|
|
|
af9b8b |
stop
|
|
|
af9b8b |
start
|
|
|
af9b8b |
fi
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
force-reload|reload)
|
|
|
af9b8b |
exit 3
|
|
|
af9b8b |
;;
|
|
|
af9b8b |
*)
|
|
|
af9b8b |
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|status|help}"
|
|
|
af9b8b |
RETVAL=2
|
|
|
af9b8b |
esac
|
|
|
af9b8b |
|
|
|
af9b8b |
exit $RETVAL
|