1 | #!/bin/athena/tcsh -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: cfields $ |
---|
8 | # $Header: /afs/dev.mit.edu/source/repository/packs/maint/clean_tmp_areas.sh,v 1.6 1996-05-09 18:23:15 cfields 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. |
---|
23 | set dirs = ( /tmp/ /usr/tmp/ /usr/spool/rwho/ \ |
---|
24 | /usr/preserve/) |
---|
25 | set timeout = ( "-atime +1" "-atime +2" "-mtime +3" \ |
---|
26 | "-mtime +3") |
---|
27 | |
---|
28 | set xdev = -mount |
---|
29 | set exceptions = "! -type b ! -type c" |
---|
30 | |
---|
31 | switch($hosttype) |
---|
32 | case sun4: |
---|
33 | set exceptions = "$exceptions ! -type p ! -name ps_data" |
---|
34 | breaksw |
---|
35 | case sgi: |
---|
36 | set exceptions = "$exceptions ! -user root" |
---|
37 | # ! -type s ! -name .ps_data ! -name .cadmin* |
---|
38 | # set noglob (for .cadmin*) |
---|
39 | breaksw |
---|
40 | case decmips: |
---|
41 | set exceptions = "$exceptions ! -type s" |
---|
42 | breaksw |
---|
43 | case rsaix: |
---|
44 | set exceptions = "$exceptions ! -type s" |
---|
45 | set xdev = -xdev |
---|
46 | breaksw |
---|
47 | default: |
---|
48 | endsw |
---|
49 | |
---|
50 | set j = 1 |
---|
51 | foreach i ($dirs) |
---|
52 | if ( -d $i ) then |
---|
53 | cd $i |
---|
54 | find . $xdev $timeout[$j] $exceptions -exec rm -f {} \; -print |
---|
55 | find . $xdev ! -name . -type d -mtime +1 -exec rmdir {} \; -print |
---|
56 | endif |
---|
57 | @ j++ |
---|
58 | end |
---|