110.clean-tmps revision 61410
1#!/bin/sh
2#
3# $FreeBSD: head/etc/periodic/daily/110.clean-tmps 61410 2000-06-08 08:48:15Z brian $
4#
5# Perform temporary directory cleaning so that long-lived systems
6# don't end up with excessively old files there.  If /var/tmp and
7# /tmp are symlinked together, only one of the below will actually
8# run.
9#
10
11# If there is a global system configuration file, suck it in.
12#
13if [ -r /etc/defaults/rc.conf ]; then
14	. /etc/defaults/rc.conf
15	source_rc_confs
16elif [ -r /etc/rc.conf ]; then
17	. /etc/rc.conf
18fi
19
20case "$clear_tmp_enable" in
21    [Yy][Ee][Ss])
22	echo ""
23	echo "Removing old temporary files:"
24
25	[ -d /tmp ] && cd /tmp && {
26	    find -d . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \
27		! -name quota.user ! -name quota.group -delete
28	    find -d . ! -name . -type d -mtime +1 -delete
29	}
30
31	[ -d /var/tmp ] && cd /var/tmp && {
32	    find -d . ! -name . -atime +7 -ctime +3 \
33		! -name quota.user ! -name quota.group -delete
34	    find -d . ! -name . ! -name vi.recover -type d -mtime +1 -delete
35	}
36
37	case "$linux_enable" in
38	    [Yy][Ee][Ss])
39		[ -d /compat/linux/tmp ] && cd /compat/linux/tmp && {
40		    find -d . ! -name . -atime +7 -ctime +3 \
41			! -name quota.user ! -name quota.group -delete
42		    find -d . ! -name . -type d -mtime +1 -delete
43	    	};;
44	esac
45esac
46