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

Revision 810, 1.3 KB checked in by shanzer, 37 years ago (diff)
Does not remove special files (sockets, block, nd charcter special files.
  • 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# 05 1 * * *    root    find /tmp -atime +1 -exec rm -f {} \;
7# 10 1 * * *    root    cd /tmp; find . ! -name . -type d -mtime +1 -exec rm -r {} \;
8# 15 1 * * *    root    find /usr/tmp -atime +2 -exec rm -f {} \;
9# 20 1 * * *    root    cd /usr/tmp; find . ! -name . -type d -mtime +1 -exec rmdir {} \;
10# 10 4 * * *    root    (cd /usr/spool/rwho; find . -name whod.\* -mtime +7 -exec rm -f {} \;)
11# 15 4 * * *    root    (cd /usr/preserve; find . -mtime +7 -a -exec rm -f {} \;)
12#
13# It was discovered that on systems which do not have a /usr/tmp, and are
14#       idle much of the time, such as VS2 workstations, the "05 1" & "10 1"
15#       lines will delete everything in /tmp.  This allows the "20 1" line
16#       to delete /tmp, since there is no /usr/tmp.  This allows "10 1" to
17#       delete EVERYTHING on the disk which has not been accessed in 24
18#       hours.  AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHH!!!!!!!! From Berkeley.
19set dirs =    ( /tmp/           /usr/tmp/       /usr/spool/rwho/ \
20                /usr/preserve/)
21set timeout = ( "-atime +1"     "-atime +2"     "-mtime +3" \
22                "-mtime +3")
23
24set j = 1
25foreach i ($dirs)
26        if ( -d $i ) then
27                cd $i
28                find . $timeout[$j] ! -type b ! -type c ! -type s -exec rm -f {} \; -print
29                find . ! -name . -type d -mtime +1 -exec rmdir {} \; -print
30        endif
31@ j++
32end     
Note: See TracBrowser for help on using the repository browser.