Re: Opinions sought: mlocate appropriate for Priority: standard?
>>>>> Andreas Metzler <ametzler@downhill.at.eu.org> writes:
>> May I suggest a single `update-locate' script, with different
>> implementations (`update-locate.findutils', etc.) belonging to the
>> same alternatives group as `locate' and `updatedb'? This reduces
>> the cron.daily script to a single line of code (though I don't know
>> which package to put it in.)
>> [...]
> I do not think that would work well, diffrent locates have different
> featuresets (and options).
It's the precise reason behind having per-locate
`update-locate.PACKAGE' scripts. Everything required to update
the database for any given locate (currently in
/etc/cron.daily/PACKAGE) is to be put into a /usr/sbin/-script
(/usr/sbin/update-locate.PACKAGE.) Like:
$ cat /usr/bin/update-locate.slocate
#! /bin/sh
if [ -x /usr/bin/slocate ]
then
if [ -f /etc/updatedb.conf ]
then
/usr/bin/updatedb
else
/usr/bin/updatedb -f proc
fi
chown root.slocate /var/lib/slocate/slocate.db
fi
$ cat /usr/bin/update-locate.findutils
#! /bin/sh
#
# former cron script to update the `locatedb' database.
#
# Written by Ian A. Murdock <imurdock@debian.org> and
# Kevin Dalley <kevin@aimnet.com>
LOCALUSER="nobody"
export LOCALUSER
if [ -f /etc/updatedb.conf ]; then
. /etc/updatedb.conf
fi
if getent passwd $LOCALUSER > /dev/null ; then
cd / && nice -n ${NICE:-10} updatedb 2>/dev/null
else
echo "User $LOCALUSER does not exist."
exit 1
fi
$
The cron script, /etc/cron.daily/, then checks whether
/usr/sbin/update-locate (managed by the alternatives system)
exists, and, if it is, calls it:
$ cat /etc/cron.daily/update-locate
#!/bin/sh
if [ -x /usr/sbin/update-locate ]; then
/usr/sbin/update-locate
fi
Or am I missing something?
Reply to: