File cron.daily.updatedb of Package findutils

#!/bin/sh
#
#
# updatedb. This script was split off cron.daily.
# Please add your local changes to cron.daily.local
# since this file will be overwritten, when updating your system.
#
# Copyright (c) 2003 SuSE Linux AG, Nuernberg, Germany.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#
# Author: Burchard Steinbild <bs@suse.de>, 1996
#         Florian La Roche <florian@suse.de>, 1996
#
#
#


#
# paranoia settings
#
umask 022

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

#
# get information from /etc/rc.config
#
if [ -f /etc/sysconfig/locate ] ; then
    . /etc/sysconfig/locate
fi

#
# update database for locate
#
if [ -n "$RUN_UPDATEDB" -a "$RUN_UPDATEDB" = "yes" -a \
     -x /usr/bin/updatedb ] ; then

    # avoid error messages from updatedb when using user nobody for find.
    cd / 

    PARAMS="`test -n "$RUN_UPDATEDB_AS" && \
            fgrep localuser /usr/bin/updatedb > /dev/null && \
            echo --localuser=$RUN_UPDATEDB_AS`"

    PARAMS="$PARAMS `test -n "$UPDATEDB_PRUNEPATHS" && \
            echo --prunepaths=\'$(eval echo $UPDATEDB_PRUNEPATHS)\'`"

    PARAMS="$PARAMS `test -n "$UPDATEDB_NETUSER" && \
            echo --netuser=$UPDATEDB_NETUSER`"

    PARAMS="$PARAMS `test -n "$UPDATEDB_NETPATHS" && \
            echo --netpaths=\'$(eval echo $UPDATEDB_NETPATHS)\'`"

    PARAMS="$PARAMS `test -n "$UPDATEDB_PRUNEFS" && \
            echo --prunefs=\'$(eval echo $UPDATEDB_PRUNEFS)\'`"

    eval nice -n 19 ionice -c 3 /usr/bin/updatedb $PARAMS 2> /dev/null
fi


exit 0