:
#	@(#) cleantmp.sh 22.1 90/05/03 
#
#	Copyright (C) The Santa Cruz Operation, 1988.
#	This Module contains Proprietary Information of
#	The Santa Cruz Operation, and should be treated as Confidential.
#
#	/usr/lib/cleantmp - remove temporary files.

# Begin SCO_BASE

DESTDIR=
DEFAULT=$DESTDIR/etc/default/cleantmp

# number of days before file aging occurs
days=`sed -n "/^FILEAGING=[0-9]*$/s/FILEAGING=//p" $DEFAULT`

# directories where temporary files are removed.
dirs=`sed -n "/^TMPDIRS=[/]\{0,1\}.*$/s/TMPDIRS=//p" $DEFAULT`

# search through directories to remove files.
for i in $dirs
do
	if [ -d $i ] 
	then 
		find $i -atime +$days -exec rm -f {} \;
	else
		echo "Message from /usr/lib/cleantmp :\n
$i does not exist or is not a mounted file system. 
Cleantmp cannot remove files from the directory." > /tmp/clean$$
		cat /tmp/clean$$
		[ -x /bin/mail ] && {
		mail root < /tmp/clean$$
		}
		rm -f /tmp/clean$$
	fi
done

# End SCO_BASE
