#!/bin/sh # $FreeBSD$ # # PROVIDE: htcacheclean # # Configuration settings for htcacheclean in /etc/rc.conf # # htcacheclean_enable (bool) # Set to "NO" by default # Set it to "YES" to enable htcacheclean # # htcacheclean_cache (str) Set to "%%PREFIX%%/www/proxy" by default Set the # location of the mod_disk_cache CacheRoot This should be the same as whats in # your httpd.conf # # htcacheclean_cachelimit (str) Set to "512M" by default Sets the size # htcacheclean should prune the disk cache to expressed in bytes by default, K # for kilobytes, M for megabytes. # # htcacheclean_interval (num) # Set to "10" by default # Sets how frequently in munutes htcacheclean wakes up and prunes the cache # # htcacheclean_args (str) # Set to "-t -n -i" by default # Sets extra command-line arguments to htcacheclean # -t Delete all empty directories # -n Be nice by sleeping occasionally to not saturate the I/O bandwith of the disk # -i Run only when there was a modification of the disk cache . /etc/rc.subr name="htcacheclean" rcvar=htcacheclean_enable load_rc_config "${name}" htcacheclean_enable="${htcacheclean_enable:-"NO"}" htcacheclean_cache="${htcacheclean_cache:-"%%PREFIX%%/www/proxy"}" htcacheclean_cachelimit="${htcacheclean_cachelimit:-"512M"}" htcacheclean_interval="${htcacheclean_interval:-"60"}" htcacheclean_args="${htcacheclean_args:-"-t -n -i"}" start_precmd="htc_check" restart_precmd="htc_check" restart_reload="htc_check" command="%%PREFIX%%/sbin/htcacheclean" flags="-p${htcacheclean_cache} -d${htcacheclean_interval} -l${htcacheclean_cachelimit} ${htcacheclean_args}" required_dirs="${htcacheclean_cache}" htc_check() { [ ! -d ${htcacheclean_cache} ] && { echo "" return 1 } return 0 } run_rc_command "$1"