rebuild locate database

FreeBSD Installation tips

rebuild locate database

Postby stephen » Sun Apr 11, 2010 12:39 pm

In Freebsd this is the script to run to rebuild the locate database.
/etc/periodic/weekly/310.locate
Code: Select all
#!/bin/sh -
#
# $FreeBSD: src/etc/periodic/weekly/310.locate,v 1.7.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$weekly_locate_enable" in
    [Yy][Ee][Ss])
        echo ""
        echo "Rebuilding locate database:"

        locdb=/var/db/locate.database

        touch $locdb && rc=0 || rc=3
        chown nobody $locdb || rc=3
        chmod 644 $locdb || rc=3

        cd /
        echo /usr/libexec/locate.updatedb | nice -n 5 su -fm nobody || rc=3
        chmod 444 $locdb || rc=3;;

    *)  rc=0;;
esac

stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

Return to FreeBSD

Who is online

Users browsing this forum: No registered users and 1 guest

cron