diff options
Diffstat (limited to 'etc/periodic/weekly/310.locate')
-rwxr-xr-x | etc/periodic/weekly/310.locate | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/etc/periodic/weekly/310.locate b/etc/periodic/weekly/310.locate index b616a4ab4573..53d3d8001641 100755 --- a/etc/periodic/weekly/310.locate +++ b/etc/periodic/weekly/310.locate @@ -2,16 +2,30 @@ # # $FreeBSD$ # -locdb=/var/db/locate.database -if [ -x /usr/libexec/locate.updatedb -a -f $locdb ] ; then +# 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 - echo "" - echo "Rebuilding locate database:" +case "$weekly_locate_enable" in + [Yy][Ee][Ss]) + if [ -x /usr/libexec/locate.updatedb -a -f $locdb ] + then + echo "" + echo "Rebuilding locate database:" - touch ${locdb}; chown nobody ${locdb}; chmod 644 ${locdb} + locdb=/var/db/locate.database - cd / - echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody - chmod 444 ${locdb} -fi + touch $locdb + chown nobody $locdb + chmod 644 $locdb + + cd / + echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody + chmod 444 $locdb + fi;; +esac |