weekly revision 1.9
11.1Scgd#!/bin/sh -
21.1Scgd#
31.9Slukem#	$NetBSD: weekly,v 1.9 1997/10/27 04:11:40 lukem Exp $
41.7Smikel#	from: @(#)weekly	8.2 (Berkeley) 1/2/94
51.1Scgd#
61.1Scgd
71.1ScgdPATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
81.1Scgdexport PATH
91.1Scgd
101.6Smrgumask 077
111.6Smrg
121.7Smikelhost=`hostname`
131.1Scgdecho "Subject: $host weekly run output"
141.1Scgd
151.6Smrgif [ -s /etc/weekly.conf ]; then
161.6Smrg	. /etc/weekly.conf
171.6Smrgfi
181.6Smrg
191.1Scgd#echo ""
201.1Scgd#echo "Removing old .o files:"
211.1Scgd#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
221.1Scgd
231.1Scgd# see if /usr/src exists and is local
241.1Scgd# before looking there for checked-out files
251.1Scgd
261.2Scgd#if [ -d /usr/src -a \
271.8Smycroft#  -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ];
281.2Scgd#then
291.2Scgd#	echo "looking for checked out files:"
301.2Scgd#	TDIR=/tmp/_checkout$$
311.2Scgd#
321.2Scgd#	mkdir $TDIR
331.2Scgd#	for file in `find -f /usr/src ! -fstype local -prune -or \
341.2Scgd#	    -name 'p.*' -print | egrep 'SCCS/p\.'`; do
351.2Scgd#		owner=`awk '{ print $3 }' $file`
361.2Scgd#		echo "$owner	$file"
371.2Scgd#		echo $file >> $TDIR/$owner
381.2Scgd#	done | sed -e 's,SCCS/p.,,'
391.7Smikel#	if test -n "`ls $TDIR`"; then
401.7Smikel#		for file in $TDIR/*; do
411.7Smikel#			sed -e 's,SCCS/p.,,' $file | \
421.7Smikel#			    Mail -s 'checked out files' `basename $file`
431.7Smikel#		done
441.7Smikel#	fi
451.2Scgd#	rm -rf $TDIR
461.2Scgd#fi
471.1Scgd
481.9Slukemif [ "$clean_uucp" = YES ] && [ -f /usr/libexec/uucp/clean.weekly ]; then
491.1Scgd	echo ""
501.1Scgd	echo "Cleaning up UUCP:"
511.9Slukem	su daemon -c /usr/libexec/uucp/clean.weekly
521.1Scgdfi
531.1Scgdecho ""
541.1Scgd
551.1Scgdecho ""
561.8Smycroftif [ "$rebuild_locatedb" = YES ] && [ -f /var/db/locate.database ]; then
571.4Scgd	echo "Rebuilding locate database:"
581.4Scgd	chmod 644 /var/db/locate.database
591.4Scgd	chown nobody.nobody /var/db/locate.database
601.9Slukem	nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null
611.4Scgd	chown root.wheel /var/db/locate.database
621.4Scgdelse
631.4Scgd	echo "Not rebuilding locate database; no /var/db/locate.database"
641.4Scgdfi
65