xref: /freebsd/usr.sbin/periodic/etc/weekly/310.locate (revision 8881d206f4e68b564c2c5f50fc717086fc3e827a)
1#!/bin/sh -
2#
3# $FreeBSD$
4#
5
6# If there is a global system configuration file, suck it in.
7#
8if [ -r /etc/defaults/periodic.conf ]
9then
10    . /etc/defaults/periodic.conf
11    source_periodic_confs
12fi
13
14case "$weekly_locate_enable" in
15    [Yy][Ee][Ss])
16	echo ""
17	echo "Rebuilding locate database:"
18
19        . /etc/locate.rc
20	: ${FCODES:="/var/db/locate.database"}
21        locdb="$FCODES"
22
23	touch $locdb && rc=0 || rc=3
24	chown nobody $locdb || rc=3
25	chmod 644 $locdb || rc=3
26
27	cd /
28	echo /usr/libexec/locate.updatedb | nice -n 5 su -fm nobody || rc=3
29	chmod 444 $locdb || rc=3;;
30
31    *)  rc=0;;
32esac
33
34exit $rc
35