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

Revision 11062, 702 bytes checked in by ghudson, 26 years ago (diff)
From nathanw: rewrite in sh. Some differences: * /usr -> /var in /usr/tmp, /usr/preserve. * Ignore /usr/spool/rwho. * Ignore old platforms.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# $Id: clean_tmp_areas.sh,v 1.9 1998-01-21 21:53:02 ghudson Exp $
3# Script to clean up some temporary areas in a vaguely general manner.
4
5PATH=/bin/athena:/bin:/usr/bin
6dirs=/tmp:"-atime +1":/var/tmp:"-atime +2":/var/preserve:"-mtime +3"
7
8xdev=-mount
9exceptions="! -type b ! -type c"
10args=
11
12case `machtype` in
13sun4)
14        exceptions="$exceptions ! -type p ! -name ps_data"
15        ;;
16sgi)
17        exceptions="$exceptions ! -type p ! -type s ! -user root"
18        ;;
19esac
20
21oldifs="$IFS"
22IFS=:
23set -- $dirs
24IFS="$oldifs"
25while [ $# -gt 1 ]; do
26        if cd $1; then
27                find $args . $xdev $2 $exceptions -exec rm -f {} \; -print
28                find $args . $xdev -depth ! -name . -type d -mtime +1 -exec rmdir {} \; -print
29        fi
30        shift 2
31done
Note: See TracBrowser for help on using the repository browser.