Home | History | Annotate | Line # | Download | only in etc
weekly revision 1.10
      1   1.1      cgd #!/bin/sh -
      2   1.1      cgd #
      3  1.10    lukem #	$NetBSD: weekly,v 1.10 1998/01/26 12:02:58 lukem Exp $
      4   1.7    mikel #	from: @(#)weekly	8.2 (Berkeley) 1/2/94
      5   1.1      cgd #
      6   1.1      cgd 
      7   1.1      cgd PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
      8   1.1      cgd export PATH
      9  1.10    lukem host=`hostname`
     10  1.10    lukem echo "Subject: $host weekly run output"
     11   1.1      cgd 
     12   1.6      mrg umask 077
     13   1.6      mrg 
     14  1.10    lukem if [ -f /etc/rc.subr ]; then
     15  1.10    lukem 	. /etc/rc.subr
     16  1.10    lukem else
     17  1.10    lukem 	echo "Can't read /etc/rc.subr; aborting."
     18  1.10    lukem 	exit 1;
     19  1.10    lukem fi
     20   1.1      cgd 
     21   1.6      mrg if [ -s /etc/weekly.conf ]; then
     22   1.6      mrg 	. /etc/weekly.conf
     23   1.6      mrg fi
     24   1.6      mrg 
     25   1.1      cgd #echo ""
     26   1.1      cgd #echo "Removing old .o files:"
     27   1.1      cgd #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
     28   1.1      cgd 
     29   1.1      cgd # see if /usr/src exists and is local
     30   1.1      cgd # before looking there for checked-out files
     31   1.1      cgd 
     32   1.2      cgd #if [ -d /usr/src -a \
     33   1.8  mycroft #  -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ];
     34   1.2      cgd #then
     35   1.2      cgd #	echo "looking for checked out files:"
     36   1.2      cgd #	TDIR=/tmp/_checkout$$
     37   1.2      cgd #
     38   1.2      cgd #	mkdir $TDIR
     39   1.2      cgd #	for file in `find -f /usr/src ! -fstype local -prune -or \
     40   1.2      cgd #	    -name 'p.*' -print | egrep 'SCCS/p\.'`; do
     41   1.2      cgd #		owner=`awk '{ print $3 }' $file`
     42   1.2      cgd #		echo "$owner	$file"
     43   1.2      cgd #		echo $file >> $TDIR/$owner
     44   1.2      cgd #	done | sed -e 's,SCCS/p.,,'
     45   1.7    mikel #	if test -n "`ls $TDIR`"; then
     46   1.7    mikel #		for file in $TDIR/*; do
     47   1.7    mikel #			sed -e 's,SCCS/p.,,' $file | \
     48   1.7    mikel #			    Mail -s 'checked out files' `basename $file`
     49   1.7    mikel #		done
     50   1.7    mikel #	fi
     51   1.2      cgd #	rm -rf $TDIR
     52   1.2      cgd #fi
     53   1.1      cgd 
     54  1.10    lukem if checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then
     55   1.1      cgd 	echo ""
     56   1.1      cgd 	echo "Cleaning up UUCP:"
     57   1.9    lukem 	su daemon -c /usr/libexec/uucp/clean.weekly
     58   1.1      cgd fi
     59   1.1      cgd echo ""
     60   1.1      cgd 
     61   1.1      cgd echo ""
     62  1.10    lukem if checkyesno rebuild_locatedb && [ -f /var/db/locate.database ]; then
     63   1.4      cgd 	echo "Rebuilding locate database:"
     64   1.4      cgd 	chmod 644 /var/db/locate.database
     65   1.4      cgd 	chown nobody.nobody /var/db/locate.database
     66   1.9    lukem 	nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null
     67   1.4      cgd 	chown root.wheel /var/db/locate.database
     68   1.4      cgd else
     69   1.4      cgd 	echo "Not rebuilding locate database; no /var/db/locate.database"
     70   1.4      cgd fi
     71