[6866] | 1 | #!/bin/athena/tcsh -f |
---|
[38] | 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 | # |
---|
[922] | 6 | # $Source: /afs/dev.mit.edu/source/repository/packs/maint/clean_tmp_areas.sh,v $ |
---|
[10130] | 7 | # $Author: danw $ |
---|
| 8 | # $Header: /afs/dev.mit.edu/source/repository/packs/maint/clean_tmp_areas.sh,v 1.8 1997-06-03 22:45:08 danw Exp $ |
---|
[922] | 9 | # |
---|
[38] | 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") |
---|
[6866] | 27 | |
---|
[8384] | 28 | set xdev = -mount |
---|
| 29 | set exceptions = "! -type b ! -type c" |
---|
[38] | 30 | |
---|
[6866] | 31 | switch($hosttype) |
---|
| 32 | case sun4: |
---|
[8384] | 33 | set exceptions = "$exceptions ! -type p ! -name ps_data" |
---|
| 34 | breaksw |
---|
| 35 | case sgi: |
---|
[8747] | 36 | set exceptions = "$exceptions ! -type p ! -type s ! -user root" |
---|
[8384] | 37 | # ! -type s ! -name .ps_data ! -name .cadmin* |
---|
| 38 | # set noglob (for .cadmin*) |
---|
| 39 | breaksw |
---|
[6866] | 40 | case decmips: |
---|
[8384] | 41 | set exceptions = "$exceptions ! -type s" |
---|
| 42 | breaksw |
---|
| 43 | case rsaix: |
---|
| 44 | set exceptions = "$exceptions ! -type s" |
---|
| 45 | set xdev = -xdev |
---|
| 46 | breaksw |
---|
[6866] | 47 | default: |
---|
| 48 | endsw |
---|
| 49 | |
---|
[38] | 50 | set j = 1 |
---|
| 51 | foreach i ($dirs) |
---|
| 52 | if ( -d $i ) then |
---|
| 53 | cd $i |
---|
[6866] | 54 | find . $xdev $timeout[$j] $exceptions -exec rm -f {} \; -print |
---|
[10130] | 55 | find . $xdev -depth ! -name . -type d -mtime +1 -exec rmdir {} \; -print |
---|
[38] | 56 | endif |
---|
| 57 | @ j++ |
---|
| 58 | end |
---|