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