aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2000-06-08 08:48:15 +0000
committerBrian Somers <brian@FreeBSD.org>2000-06-08 08:48:15 +0000
commit335844a6c38fef94b3ce0d5458588d4eac604f33 (patch)
treea3b84c2abb85960c7c7d1736b574416ecb155f4d /etc/periodic
parent5b36316f6282bcb307f36acd6807fe2e69701646 (diff)
downloadsrc-335844a6c38fef94b3ce0d5458588d4eac604f33.tar.gz
src-335844a6c38fef94b3ce0d5458588d4eac604f33.zip
Clean /tmp and /var/tmp if $clear_tmp_enable is set to YES in rc.conf
Clean /compat/linux/tmp if $linux_enable is also set to YES in rc.conf
Notes
Notes: svn path=/head/; revision=61410
Diffstat (limited to 'etc/periodic')
-rwxr-xr-xetc/periodic/daily/110.clean-tmps51
1 files changed, 35 insertions, 16 deletions
diff --git a/etc/periodic/daily/110.clean-tmps b/etc/periodic/daily/110.clean-tmps
index 78d817eeba72..c083f500baf1 100755
--- a/etc/periodic/daily/110.clean-tmps
+++ b/etc/periodic/daily/110.clean-tmps
@@ -2,25 +2,44 @@
#
# $FreeBSD$
#
-# Use at your own risk, but for a long-living system, this might come
-# more useful than the boot-time cleaning of /tmp. If /var/tmp and
+# Perform temporary directory cleaning so that long-lived systems
+# don't end up with excessively old files there. If /var/tmp and
# /tmp are symlinked together, only one of the below will actually
# run.
#
-exit 0 # do not run by default
-
-if [ -d /tmp ]; then
- cd /tmp && {
- find . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \
- ! -name quota.user ! -name quota.group -delete
- find -d . ! -name . -type d -mtime +1 -delete
- }
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+ . /etc/defaults/rc.conf
+ source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+ . /etc/rc.conf
fi
-if [ -d /var/tmp ]; then
- cd /var/tmp && {
- find . ! -name . -atime +7 -ctime +3 -delete
- find -d . ! -name . ! -name vi.recover -type d -mtime +1 -delete
- }
-fi
+case "$clear_tmp_enable" in
+ [Yy][Ee][Ss])
+ echo ""
+ echo "Removing old temporary files:"
+
+ [ -d /tmp ] && cd /tmp && {
+ find -d . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \
+ ! -name quota.user ! -name quota.group -delete
+ find -d . ! -name . -type d -mtime +1 -delete
+ }
+
+ [ -d /var/tmp ] && cd /var/tmp && {
+ find -d . ! -name . -atime +7 -ctime +3 \
+ ! -name quota.user ! -name quota.group -delete
+ find -d . ! -name . ! -name vi.recover -type d -mtime +1 -delete
+ }
+
+ case "$linux_enable" in
+ [Yy][Ee][Ss])
+ [ -d /compat/linux/tmp ] && cd /compat/linux/tmp && {
+ find -d . ! -name . -atime +7 -ctime +3 \
+ ! -name quota.user ! -name quota.group -delete
+ find -d . ! -name . -type d -mtime +1 -delete
+ };;
+ esac
+esac