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