summaryrefslogtreecommitdiffstats
path: root/www/apache22/files/htcacheclean.in
blob: 656f75365cfbe3565e6d0921f782c170c43830b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/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"
OpenPOWER on IntegriCloud