summaryrefslogtreecommitdiff
path: root/etc/weekly
blob: f6a0bf09c2ed5b31d906731326a7c481620249d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh -
#
#	$OpenBSD: weekly,v 1.7 1997/09/15 09:54:40 deraadt Exp $
#

PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
export PATH

host=`hostname -s`
echo "Subject: $host weekly run output"

if [ -f /etc/weekly.local ];then
	echo ""
	echo "Running weekly.local:"
	. /etc/weekly.local
fi

if [ -f /usr/lib/uucp/clean.weekly ]; then
	echo ""
	echo "Cleaning up UUCP:"
	echo /usr/lib/uucp/clean.weekly | su daemon
fi

echo ""
if [ -f /var/db/locate.database ]; then
	TMP=`mktemp /var/db/locate.database.XXXXXX`
	if [ $? -eq 0 ]; then
		trap 'rm -f $TMP' 0 1 15
		echo "Rebuilding locate database:"
		echo "/usr/libexec/locate.updatedb --fcodes=-" | \
		    nice -5 su -m nobody 2>/dev/null 1>$TMP
		if [ -s "$TMP" ]; then
			chmod 444 $TMP
			chown root.wheel $TMP
			mv -f $TMP /var/db/locate.database
		else
			echo "Not installing locate database; zero size"
		fi
	else
		echo "Not rebuilding locate database; can't create temp file"
	fi
else
	echo "Not rebuilding locate database; no /var/db/locate.database"
fi