xref: /freebsd/usr.sbin/periodic/etc/weekly/310.locate (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
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	locdb=/var/db/locate.database
20
21	touch $locdb && rc=0 || rc=3
22	chown nobody $locdb || rc=3
23	chmod 644 $locdb || rc=3
24
25	cd /
26	echo /usr/libexec/locate.updatedb | nice -n 5 su -fm nobody || rc=3
27	chmod 444 $locdb || rc=3;;
28
29    *)  rc=0;;
30esac
31
32exit $rc
33