source: trunk/packs/maint/clean_tmp_areas.sh @ 922

Revision 922, 1.6 KB checked in by treese, 37 years ago (diff)
Don't cross filesystem boundaries.
  • Property svn:executable set to *
Line 
1#!/bin/csh -f
2#
3# This script is intended to replace the following "finds" which were
4#       intended to clean up /tmp, /usr/tmp and some other areas.
5#
6#       $Source: /afs/dev.mit.edu/source/repository/packs/maint/clean_tmp_areas.sh,v $
7#       $Author: treese $
8#       $Header: /afs/dev.mit.edu/source/repository/packs/maint/clean_tmp_areas.sh,v 1.3 1987-12-05 18:23:31 treese Exp $
9#
10# 05 1 * * *    root    find /tmp -atime +1 -exec rm -f {} \;
11# 10 1 * * *    root    cd /tmp; find . ! -name . -type d -mtime +1 -exec rm -r {} \;
12# 15 1 * * *    root    find /usr/tmp -atime +2 -exec rm -f {} \;
13# 20 1 * * *    root    cd /usr/tmp; find . ! -name . -type d -mtime +1 -exec rmdir {} \;
14# 10 4 * * *    root    (cd /usr/spool/rwho; find . -name whod.\* -mtime +7 -exec rm -f {} \;)
15# 15 4 * * *    root    (cd /usr/preserve; find . -mtime +7 -a -exec rm -f {} \;)
16#
17# It was discovered that on systems which do not have a /usr/tmp, and are
18#       idle much of the time, such as VS2 workstations, the "05 1" & "10 1"
19#       lines will delete everything in /tmp.  This allows the "20 1" line
20#       to delete /tmp, since there is no /usr/tmp.  This allows "10 1" to
21#       delete EVERYTHING on the disk which has not been accessed in 24
22#       hours.  AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHH!!!!!!!! From Berkeley.
23set dirs =    ( /tmp/           /usr/tmp/       /usr/spool/rwho/ \
24                /usr/preserve/)
25set timeout = ( "-atime +1"     "-atime +2"     "-mtime +3" \
26                "-mtime +3")
27
28set j = 1
29foreach i ($dirs)
30        if ( -d $i ) then
31                cd $i
32                find . -xdev $timeout[$j] ! -type b ! -type c ! -type s -exec rm -f {} \; -print
33                find . -xdev ! -name . -type d -mtime +1 -exec rmdir {} \; -print
34        endif
35@ j++
36end     
Note: See TracBrowser for help on using the repository browser.