xref: /freebsd/usr.sbin/periodic/etc/weekly/310.locate (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#!/bin/sh -
2#
3#
4
5# If there is a global system configuration file, read it.
6#
7if [ -r /etc/defaults/periodic.conf ]; then
8	. /etc/defaults/periodic.conf
9	source_periodic_confs
10fi
11
12case "$weekly_locate_enable" in
13	[Yy][Ee][Ss])
14	echo ""
15	echo "Rebuilding locate database:"
16
17	. /etc/locate.rc
18	: "${FCODES:=/var/db/locate.database}"
19	locdb="$FCODES"
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