[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Updatedb on demand

Posted on 2006-06-23
5
Medium Priority
?
269 Views
Last Modified: 2010-04-20
it's possible, so the system database is uptodate ever when new files is created or deleted?
0
Comment
Question by:rubentrancoso
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:pjedmond
ID: 16968433
Well you could replace the rm command with an script that first runs the rm command, and then runs updatedb on the path concerned. However, there aer numberous otherways to delete files, so this approach isn't exactly doing to be 100% perfect.

With respect to making new files, there are so many programs that make files, that trying to use a similar approach wouldn't really be possible:(

I guess that the best bet for you would be to run updatedb as a cron job everynight (or at a quiet time) to ensure that the data was reasonably current?

crontab -e

Then add the line(or similar):

45 23 * * * /path/to/updatedb

(   (()
(`-' _\
 ''  ''
0
 
LVL 16

Expert Comment

by:xDamox
ID: 16971002
Hi,

In your cron.daily directory located in the /etc you might have the following file:

mlocate.cron

This file runs updatedb daily.
0
 

Author Comment

by:rubentrancoso
ID: 16971120
ok, but It's not what I was asking. I already know cron. My questin is regard some way to monitor all files and update on demand.
0
 
LVL 16

Expert Comment

by:xDamox
ID: 16971186
The only method I can think of is once you have deleted a file that you the user run the updatedb command
0
 
LVL 22

Accepted Solution

by:
pjedmond earned 1000 total points
ID: 16971519
As I alluded, you can either create a script called rm and rename rm to something else that gets called, or you can have your own special updating rm say surm:

-----------8X----------------------
#!/bin/bash

UDP=${1%/*}

echo $UDP

if [ "$UDP" eq "$1" ]
then
  rm $1
  updatedb -U .      # If no directory, update the cwd
else
  rm $1
  updatedb -U $UDP   # Just update the directory adffected
fi
-----------8X----------------------

Which does the updating for you. For creating files, there are so may ways that something like that can be done, that you'd have to patch all sorts of things, or create wrappers around them...and then start on the process of dealling with applications. Of course you could start 'patching' the glibc, but then when people (or you) want performance creating and deleteing files, you will get a fairly severe performance degradation.

 (   (()
(`-' _\
 ''  ''
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question