[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Updatedb on demand

Posted on 2006-06-23
5
Medium Priority
?
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

649 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