HAMMER Utilities: Mirroring and pseudo-fs directives
[dragonfly.git] / etc / periodic / daily / 140.clean-rwho
blob1c4ac7d778cde8af8ac6232138c2e181d40c23e2
1 #!/bin/sh
3 # $FreeBSD: src/etc/periodic/daily/140.clean-rwho,v 1.4.2.2 2000/09/20 02:46:15 jkh Exp $
4 # $DragonFly: src/etc/periodic/daily/140.clean-rwho,v 1.2 2003/06/17 04:24:48 dillon Exp $
6 # Remove stale files in /var/rwho
9 # If there is a global system configuration file, suck it in.
11 if [ -r /etc/defaults/periodic.conf ]
12 then
13 . /etc/defaults/periodic.conf
14 source_periodic_confs
17 case "$daily_clean_rwho_enable" in
18 [Yy][Ee][Ss])
19 if [ -z "$daily_clean_rwho_days" ]
20 then
21 echo '$daily_clean_rwho_enable is enabled but' \
22 '$daily_clean_rwho_days is not set'
23 rc=2
24 elif [ ! -d /var/rwho ]
25 then
26 echo '$daily_clean_rwho_enable is enabled but /var/rwho' \
27 "doesn't exist"
28 rc=2
29 else
30 echo ""
31 echo "Removing stale files from /var/rwho:"
33 case "$daily_clean_rwho_verbose" in
34 [Yy][Ee][Ss])
35 print=-print;;
37 print=;;
38 esac
40 if cd /var/rwho
41 then
42 rc=$(find . ! -name . -mtime +$daily_clean_rwho_days \
43 -delete $print | tee /dev/stderr | wc -l)
44 [ -z "$print" ] && rc=0
45 [ $rc -gt 1 ] && rc=1
46 else
47 rc=3
49 fi;;
51 *) rc=0;;
52 esac
54 exit $rc