Tweak www/apache22 version 2.2.26
[dports.git] / www / apache22 / files / htcacheclean.in
1 #!/bin/sh
2
3 # $FreeBSD: www/apache22/files/htcacheclean.in 340872 2014-01-24 00:14:07Z mat $
4 #
5 # PROVIDE: htcacheclean
6 #
7 # Configuration settings for htcacheclean in /etc/rc.conf
8 #
9 # htcacheclean_enable (bool) 
10 # Set to "NO" by default 
11 # Set it to "YES" to enable htcacheclean
12 #
13 # htcacheclean_cache (str) Set to "%%PREFIX%%/www/proxy" by default Set the
14 # location of the mod_disk_cache CacheRoot This should be the same as whats in
15 # your httpd.conf
16 #
17 # htcacheclean_cachelimit (str) Set to "512M" by default Sets the size
18 # htcacheclean should prune the disk cache to expressed in bytes by default, K
19 # for kilobytes, M for megabytes.
20 #
21 # htcacheclean_interval (num) 
22 # Set to "10" by default
23 # Sets how frequently in munutes htcacheclean wakes up and prunes the cache
24 #
25 # htcacheclean_args (str)
26 # Set to "-t -n -i" by default
27 # Sets extra command-line arguments to htcacheclean
28 # -t Delete all empty directories
29 # -n Be nice by sleeping occasionally to not saturate the I/O bandwith of the disk
30 # -i Run only when there was a modification of the disk cache
31
32 . /etc/rc.subr
33
34 name="htcacheclean"
35 rcvar=htcacheclean_enable
36
37 load_rc_config "${name}"
38
39 htcacheclean_enable="${htcacheclean_enable:-"NO"}"
40 htcacheclean_cache="${htcacheclean_cache:-"%%PREFIX%%/www/proxy"}"
41 htcacheclean_cachelimit="${htcacheclean_cachelimit:-"512M"}"
42 htcacheclean_interval="${htcacheclean_interval:-"60"}"
43 htcacheclean_args="${htcacheclean_args:-"-t -n -i"}"
44
45 start_precmd="htc_check"
46 restart_precmd="htc_check"
47 restart_reload="htc_check"
48
49 command="%%PREFIX%%/sbin/htcacheclean"
50 flags="-p${htcacheclean_cache} -d${htcacheclean_interval} -l${htcacheclean_cachelimit} ${htcacheclean_args}"
51 required_dirs="${htcacheclean_cache}"
52
53 htc_check()
54 {
55         [ ! -d ${htcacheclean_cache} ] && {
56                 echo ""
57                 return 1
58         }
59         return 0
60 }
61
62 run_rc_command "$1"