Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / etc / periodic / daily / 100.clean-disks
CommitLineData
984263bc
MD
1#!/bin/sh
2#
3# $FreeBSD: src/etc/periodic/daily/100.clean-disks,v 1.3.2.6 2001/04/25 12:13:12 ru Exp $
1de703da 4# $DragonFly: src/etc/periodic/daily/100.clean-disks,v 1.2 2003/06/17 04:24:48 dillon Exp $
984263bc
MD
5#
6# Remove garbage files more than $daily_clean_disks_days days old
7#
8
9# If there is a global system configuration file, suck it in.
10#
11if [ -r /etc/defaults/periodic.conf ]
12then
13 . /etc/defaults/periodic.conf
14 source_periodic_confs
15fi
16
17case "$daily_clean_disks_enable" in
18 [Yy][Ee][Ss])
19 if [ -z "$daily_clean_disks_days" ]
20 then
21 echo '$daily_clean_disks_enable is set but' \
22 '$daily_clean_disks_days is not'
23 rc=2
24 elif [ -z "$daily_clean_disks_files" ]
25 then
26 echo '$daily_clean_disks_enable is set but' \
27 '$daily_clean_disks_files is not'
28 rc=2
29 else
30 echo ""
31 echo "Cleaning disks:"
32 set -f noglob
33 args="$args -name "`echo "$daily_clean_disks_files" |
34 sed -e 's/^[ ]*//' \
35 -e 's/[ ]*$//' \
36 -e 's/[ ][ ]*/ -o -name /g'`
37
38 case "$daily_clean_disks_verbose" in
39 [Yy][Ee][Ss])
40 print=-print;;
41 *)
42 print=;;
43 esac
44
45 rc=$(find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
46 \( $args \) -atime +$daily_clean_disks_days -delete $print |
47 tee /dev/stderr | wc -l)
48 [ -z "$print" ] && rc=0
49 [ $rc -gt 1 ] && rc=1
50 set -f glob
51 fi;;
52
53 *) rc=0;;
54esac
55
56exit $rc