LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-10-2011, 12:19 PM   #1
george-lappies
Member
 
Registered: May 2011
Location: Secunda, South Africa
Distribution: Slackware 13.37
Posts: 181

Rep: Reputation: 9
Question Does updatedb run by itself or only manually?


I want to use updatedb to index an external hard disk drive. I mount the drive under /media/external and removed '/media' from the PRUNEPATHS in /etc/updatedb.conf file.

This works and I can search for files when the drive is not connected using slocate. However it takes sometime to index the drive and I do not want updatedb to run on its own (if it ran while external is disconnected well...) and seeing as the box in question is on 24/7 if it should run by itself it will most certainly ruin the slocate db.

I was thinking of plugging the drive in and running updatedb again, once completed will this work
Code:
# slocate '/media/external' > ext_file_list
and then to find a file even when external is disconnected
Code:
grep file_i_want ~/ext_file_list
Or does any of the sages out there have a much better approach I should think of using?

Eagerly awaiting responses
 
Old 07-10-2011, 12:45 PM   #2
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
The stock Slackware runs slocate through cron.daily. The stock Slackware is configured to run daily cron events at something like 4AM in the morning. Probably a good time for servers but not a great time for desktop users.

Your prune list in /etc/updatedb.conf will prevent the daily cron job from including the external drive.

You want to index a removable drive, but you want to maintain a separate index for the external drive.

slocate has a few command options to place a database in a non-default location (man slocate). The command has options to start the index search at a specific location in the file system. For example /media/external. You could use those options to override the options in /etc/updatedb.conf.

You could write a simple script that checks for the existence of the external drive and runs slocate with your preferred options. Place the script in /usr/local/sbin, which is part of root's search path ($PATH). That allows you to run the script manually. Create a sym link in cron.daily or cron.hourly to the script. That way you can connect the external drive and let slocate run automatically rather than manually.
 
1 members found this post helpful.
Old 07-10-2011, 02:16 PM   #3
jedi_sith_fears
Member
 
Registered: Jan 2008
Location: Kolkata
Distribution: Debian GNU/Linux bookworm/sid
Posts: 136
Blog Entries: 1

Rep: Reputation: 29
Smile

Quote:
Originally Posted by Woodsman View Post
You could write a simple script that checks for the existence of the external drive and runs slocate with your preferred options. Place the script in /usr/local/sbin, which is part of root's search path ($PATH). That allows you to run the script manually. Create a sym link in cron.daily or cron.hourly to the script. That way you can connect the external drive and let slocate run automatically rather than manually.
This is probably the best idea & I came up with the same solution sometimes back for my external spare HDD.
 
Old 07-11-2011, 02:49 AM   #4
george-lappies
Member
 
Registered: May 2011
Location: Secunda, South Africa
Distribution: Slackware 13.37
Posts: 181

Original Poster
Rep: Reputation: 9
Thanks all, marking this as solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to configure updatedb to update locate database manually septanla Linux - General 4 12-22-2010 02:05 PM
[OpenBSD 4.1] run locate.updatedb after login noir911 *BSD 2 11-03-2007 10:09 AM
How can I run updatedb @reboot as a background process? randomsel Slackware 4 02-02-2007 03:36 PM
Can I run updatedb on startup? jraclarke Linux - Newbie 2 06-13-2006 04:47 PM
Run updatedb as nobody? Phathead Slackware 2 10-14-2003 06:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration