LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   my locate command says database is more than 8days old (https://www.linuxquestions.org/questions/linux-newbie-8/my-locate-command-says-database-is-more-than-8days-old-268578/)

Niceman2005 12-20-2004 06:18 PM

my locate command says database is more than 8days old
 
Dear all,

I tried to use locate to search for a file, but the following replied came out:

warning: locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old

When I "man locate" it took me to the manual page of "slocate" and so I tried slocate to search for the file bu the same result came out.

I can use find -name xxx -print to search for files but its sometimes not qutie effective and slow.

any one knows the problem please correct me,

Thanks in advance

drj000 12-20-2004 06:25 PM

Re: my locate command says database is more than 8days old
 
Quote:

Originally posted by Niceman2005
I tried to use locate to search for a file, but the following replied came out:

warning: locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old

Run updatedb as root.
I've created a cron job to run updatedb every twelve hours, so I never have a problem with an out-of-date database. You might consider doing something like that if you use locate frequently, and frequently install new programs/download stuff.

whipermr5 12-21-2004 07:03 AM

You must update the database which locate searches to find your files. Run updatedb to do this. It may take quite a while

Niceman2005 12-21-2004 06:15 PM

Thanks
whipermr5 and drj000

Although I don't quite understand why but it worked, thank you very much for helping.

drj000 12-21-2004 06:28 PM

Quote:

Originally posted by Niceman2005
Although I don't quite understand why but it worked, thank you very much for helping.
As I understand it, the locate doesn't actually search your hard-drive, but instead searches a database of all the files on your hard drive. If that database isn't kept up-to-date, it won't display accurate results, so occasionally you have to update that database by running updatedb.

Niceman2005 12-21-2004 06:36 PM

Ohooook,

thank you veyr much drj000!

Andramalech 01-04-2005 12:25 PM

Re: Re: my locate command says database is more than 8days old
 
Quote:

Originally posted by drj000
I've created a cron job to run updatedb every twelve hours, so I never have a problem with an out-of-date database. You might consider doing something like that if you use locate frequently, and frequently install new programs/download stuff.
can anybody give any tips on how to do something of this sort?

drj000 01-04-2005 04:55 PM

Re: Re: Re: my locate command says database is more than 8days old
 
Quote:

Originally posted by Andramalech
can anybody give any tips on how to do something of this sort?
For me, I have it run at 6am and 6pm, so to do that, in the file /var/spool/cron/root, it says
Code:

0 6,18 * * *        updatedb
However, I don't edit the file manually. I just run kcron as root to set it up for me.


All times are GMT -5. The time now is 02:38 PM.