Newb Question - updatedb / locate

Sorry if this may seem like a dumb question, but I just installed fedora core 2 on my linode and the commands locate or updatedb do not seem to be working.

What do I need to do to get this working or what are the equivalent commands in fedora core 2. Any help is appreciated, as I'm completely new to this.

Thanks

6 Replies

@amhost:

Sorry if this may seem like a dumb question, but I just installed fedora core 2 on my linode and the commands locate or updatedb do not seem to be working.

What do I need to do to get this working or what are the equivalent commands in fedora core 2. Any help is appreciated, as I'm completely new to this.

Thanks

Those databases are built by cron jobs which usually run daily, but I think that caker changed the install images to run them weekly to reduce cron job load on the host systems. The easiest way to make these cron jobs run early and thus create the databases you need for the locate and updatedb commands is just to run the scripts themselves - you should be able to find them in /etc/cron.weekly, I think they're called slocate and makewhatis or something like that.

thanks for the information, i will definitely look into it.

<< slocate >>

!/bin/sh

remove this to enable updating of updatedb

exit

renice +19 -p $ >/dev/null 2>&1

/usr/bin/updatedb -f "nfs,smbfs,ncpfs,proc,devpts" -e "/tmp,/var/tmp,/usr/tmp,/afs,/net"

<>

!/bin/bash

LOCKFILE=/var/lock/makewhatis.lock

the lockfile is not meant to be perfect, it's just in case the

two makewhatis cron scripts get run close to each other to keep

them from stepping on each other's toes. The worst that will

happen is that they will temporarily corrupt the database…

[ -f $LOCKFILE ] && exit 0

trap "{ rm -f $LOCKFILE; exit 255; }" EXIT

touch $LOCKFILE

makewhatis -w

exit 0

===========================================

Ok, here are the contents of those files. Remember, i'm a complete n00b, how should I edit this configuration so that the cron job runs earlier.

Thanks for all your help

@amhost:

<< slocate >>

!/bin/sh

remove this to enable updating of updatedb

exit

renice +19 -p $ >/dev/null 2>&1

/usr/bin/updatedb -f "nfs,smbfs,ncpfs,proc,devpts" -e "/tmp,/var/tmp,/usr/tmp,/afs,/net"

<>

!/bin/bash

LOCKFILE=/var/lock/makewhatis.lock

the lockfile is not meant to be perfect, it's just in case the

two makewhatis cron scripts get run close to each other to keep

them from stepping on each other's toes. The worst that will

happen is that they will temporarily corrupt the database…

[ -f $LOCKFILE ] && exit 0

trap "{ rm -f $LOCKFILE; exit 255; }" EXIT

touch $LOCKFILE

makewhatis -w

exit 0

===========================================

Ok, here are the contents of those files. Remember, i'm a complete n00b, how should I edit this configuration so that the cron job runs earlier.

Thanks for all your help

You don't edit the script, you just run it. cron will run the script once a week; if you want the same results (i.e. the building up of the databases) to happen now instead of in a week, then you can just run these scripts now instead of waiting for cron to do it (cron will still do it in a week too).

Just run the files, like:

bash$ /etc/cron.weekly/slocate

(watch its output, make sure everything was OK)

bash$ /etc/cron.weekly/makewhatis

(watch its output, make sure everything was OK)

You'll probably need to be logged in as root for these scripts to be able to do what they need to do.

Hey I just noticed something else. Looks like caker modified these files to not do anything at all, but to exit immediately. You'll need to remove the "exit" line after the "remove this to enable …" comment as well. You need to do this for both the slocate and makewhatis scripts.

Thanks for the help again bji, really appreciate it.

I took out the exit line of code in the slocate.conf file and when I tried to run it, I received an error indicating that /usr/bin/updatedb/ was not found.

I got everything working now that I ran:

yum install slocate

Thanks for all your help again.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct