Does locate update its database each time I remove a file?
Hi: What's asked.
Kernel 2.6.21.5, Slackware 12.0 slocate 3.1 |
No, you need to run
Code:
updatedb Kind regards |
However, I've just made a test, running locate and then removing (rm) one of the listed files, and locate did not listed. How can that be?
|
You are right, curious to know how this works.
Kind regards |
From the slocate manual:
Quote:
|
I would swear that locate went on displaying erased files long time after they had been erased as long as I did not run updatedb! What is curious is that I have not changed my slackware version.
|
Just a guess: Perhaps if you use locate as root it determines that you have no access restrictions and bypasses the permission tests - and therefore the 'existance' test as well.
|
It happens that I always run locate as root.
|
I'm not on Slackware. On Ubuntu, I always run updatedb as root. After that locate always give correct results.
|
Quote:
FYI, with a default, normal install of Slackware, updatedb is run daily at 0440 via a cron script in /etc/cron.daily/ |
Thanks very much. As to cron.daily, I removed the entry because sometimes updatedb began to run while I was burning optical media.
|
Burning disk at 4:40am? That's dedication.... ;)
That shouldn't effect burning media, especially since updatedb is started with: Code:
ionice -c3 nice -n 19 /usr/bin/updatedb -c /etc/updatedb.conf |
Note also that locate has two options (-e/-E) that check whether each matching file actually exists at that time, before printing the results. See the man page.
|
Well, my version is 3.1, from 2006, and only has
-e <dir1, dir2, ...> which excludes those directories from the locate database. This -e option would be very handy for me if only I knew how to use it. What I see is that Code:
semoi@darkstar:/hdaal/sma_/info$ locate beethoven |
The -e option is used in combination with the -u or-U options.
from locate, slocate, updatedb --help Code:
-e <dir1,dir2,...> - Exclude directories from the slocate database when Code:
# /etc/updatedb.conf: slocate configuration file |
But is there not a way to exclude a certain path when running locate without having to update the database again? Of course there is always locate beethoven | grep -v /home/semoi/bee9
|
Ah-ha. I just realized my mistake. I was talking about the locate from findutils, not slocate. :doh: Ignore my last post.
|
Thanks for your post anyways and regards.
|
Quote:
|
Quote:
Fine. Now watch this: Code:
semoi@darkstar:/hdaal/sma_/info$ locate beethoven |
All times are GMT -5. The time now is 02:51 PM. |