110.clean-tmps revision 29305
1#!/bin/sh 2# 3# $Id: 110.clean-tmps,v 1.2 1997/09/01 11:07:55 ache Exp $ 4# 5# This is a security hole, never use 'find' on a public directory 6# with -exec rm -f as root. This can be exploited to delete any file 7# on the system. 8# 9# Use at your own risk, but for a long-living system, this might come 10# more useful than the boot-time cleaning of /tmp. If /var/tmp and 11# /tmp are symlinked together, only one of the below will actually 12# run. 13# 14 15exit 0 # do not run by default 16 17if [ -d /tmp ]; then 18 cd /tmp && { 19 find . -type f -atime +3 -ctime +3 ! -name '.X*-lock' \ 20 -exec rm -f -- {} \; 21 find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ 22 >/dev/null 2>&1 23 } 24fi 25 26if [ -d /var/tmp ]; then 27 cd /var/tmp && { 28 find . ! -name . -atime +7 -ctime +3 -exec rm -f -- {} \; 29 find -d . ! -name . ! -name vi.recover -type d -mtime +1 -exec rmdir -- {} \; \ 30 >/dev/null 2>&1 31 } 32fi 33