diff options
Diffstat (limited to 'etc/periodic/daily/110.clean-tmps')
-rwxr-xr-x | etc/periodic/daily/110.clean-tmps | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/etc/periodic/daily/110.clean-tmps b/etc/periodic/daily/110.clean-tmps new file mode 100755 index 000000000000..960c6aa8def1 --- /dev/null +++ b/etc/periodic/daily/110.clean-tmps @@ -0,0 +1,32 @@ +#!/bin/sh +# +# $Id: 110.clean-tmps,v 1.1.1.1 1997/08/12 17:51:15 pst Exp $ +# +# This is a security hole, never use 'find' on a public directory +# with -exec rm -f as root. This can be exploited to delete any file +# on the system. +# +# 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 +# /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' \ + -exec rm -f -- {} \; + find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ + >/dev/null 2>&1 + } +fi + +if [ -d /var/tmp ]; then + cd /var/tmp && { + find . ! -name . -atime +7 -ctime +3 -exec rm -f -- {} \; + find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ + >/dev/null 2>&1 + } +fi |