UPDATEDB (Locate etc)
see also tips->locate
From Mike Andrew
'locate' and 'updatedb' are the front runners in
searching for the existence of any file on a Linux system.
In order to operate efficiently, 'locate' uses a
database rather than hunting individual directory paths.
For this to operate, and remain current, it means the database
itself must be updated.
To do to this, 'updatedb' is invoked.
You can invoke updatedb manually any time you feel like
it. However, it is quite the norm, for this binary to be
executed in a cron. Cron.daily at5 am to be exact.
The two bottom line questions you will be asking, is
The piece of magic you are interested in is
/etc/cron.d/Daily/50update-locatedb
This is a soft link to the common pool of cron scripts in
/etc/cron.d/lib The '50' tells the background cron job
the order in which to execute this, and other scripts found in
the same directory. All 'objects' found in the Daily directory
are executed at the same time each day. (see below)
Don't worry overly much about what soft links are,
essentially, this mechanisism is a very "Linux way of doing
things". A pool of common scripts are maintained in a ?lib
directory, and they are linked to, from various other parts of
the Linux file system. In this way, redundant copies of
binaries are minimised and only ONE script needs to be altered
to affect all players. In this case, of all the scripts
availaible for use by cron, in the cron library, we are
interested in the update-locatedb script.
While we are on the subject of cron libraries, do not be
overly impressed with the name. It is not for gurus only, they
are simple-enough bash shell scripts that anyone, you and i,
can write.
When is updatedb
invoked?
5:05 a every morning.
How do I change it?
Edit /etc/crontab
change the Daily script time to something other than 55 5,
OR
edit the hashed out entry for updatedb so that it runs
separately any time you like.
See cron for explanation of this
file
what directories get
included?
ALL mounted file systems, including dos,
_if_ mounted.
How do i exclude some
folders?
edit /etc/cron.d/update-locatedb
Add whatever file paths you wish to the OMIT paramater
Enjoy
|
|
|