aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic/weekly/120.clean-kvmdb
blob: dbc8f4e444bb30ca71e989beb825f3330520057f (plain) (blame)
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
#!/bin/sh -
#
# $FreeBSD$
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]; then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$weekly_clean_kvmdb_enable" in
    [Yy][Ee][Ss])
	if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
	then
	    echo ""
	    echo "Cleaning up kernel database files:"

	    kernel=`sysctl -n kern.bootfile`
	    kernel=kvm_${kernel##*/}.db

	    case "$weekly_clean_kvmdb_verbose" in
		[Yy][Ee][Ss])
		    print=-print;;
		*)
		    print=;;
	    esac

	    find /var/db -name "kvm_*.db" ! -name $kernel \
		-atime +$weekly_clean_kvmdb_days -delete $print
	fi;;
esac