110.clean-tmps revision 61410
128263Spst#!/bin/sh 228263Spst# 350472Speter# $FreeBSD: head/etc/periodic/daily/110.clean-tmps 61410 2000-06-08 08:48:15Z brian $ 428263Spst# 561410Sbrian# Perform temporary directory cleaning so that long-lived systems 661981Sbrian# don't end up with excessively old files there. If /var/tmp and 728263Spst# /tmp are symlinked together, only one of the below will actually 828263Spst# run. 961410Sbrian# 1061410Sbrian 1161981Sbrian# If there is a global system configuration file, suck it in. 1261981Sbrian# 1361981Sbrianif [ -r /etc/defaults/rc.conf ]; then 1461981Sbrian . /etc/defaults/rc.conf 1528263Spst source_rc_confs 1628263Spstelif [ -r /etc/rc.conf ]; then 1761981Sbrian . /etc/rc.conf 1861410Sbrianfi 1965843Sbrian 2061458Sbriancase "$clear_tmp_enable" in 2165843Sbrian [Yy][Ee][Ss]) 2265843Sbrian echo "" 2365843Sbrian echo "Removing old temporary files:" 2465843Sbrian 2561458Sbrian [ -d /tmp ] && cd /tmp && { 2661458Sbrian find -d . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \ 2761410Sbrian ! -name quota.user ! -name quota.group -delete 2861458Sbrian find -d . ! -name . -type d -mtime +1 -delete 2961981Sbrian } 30104574Sjoerg 31126342Sache [ -d /var/tmp ] && cd /var/tmp && { 32126342Sache find -d . ! -name . -atime +7 -ctime +3 \ 3361981Sbrian ! -name quota.user ! -name quota.group -delete 3461458Sbrian find -d . ! -name . ! -name vi.recover -type d -mtime +1 -delete 35126342Sache } 36126342Sache 37126342Sache case "$linux_enable" in 3861981Sbrian [Yy][Ee][Ss]) 3961458Sbrian [ -d /compat/linux/tmp ] && cd /compat/linux/tmp && { 4061458Sbrian find -d . ! -name . -atime +7 -ctime +3 \ 4161458Sbrian ! -name quota.user ! -name quota.group -delete 4261458Sbrian find -d . ! -name . -type d -mtime +1 -delete 4361458Sbrian };; 4461410Sbrian esac 4565843Sbrianesac 4665843Sbrian