errorCodex - Computer Questions & Solutions Forum


  errorCodex - Computer Questions & Solutions Forum » Blue Screen » Basic How-tos

Basic How-tos Help Us Noobs by Sharing Your Wisdom

Reply
 
Thread Tools
  #1  
Old 28 November 2009, 14:01
Miraenda's Avatar
Miraenda Miraenda is offline
Mime Stalker
 
Join Date: Nov 2009
Location: Coralville Iowa
Age: 37
Posts: 75
Miraenda has disabled reputation
Default Install updatedb and locate on CentOS / RedHat

Install mlocate

If you do not already have locate available on your server, run the following command in root shell to install it via yum:
Code:
yum install mlocate
Running updatedb

If you do have locate installed, but updatedb has not processed yet on the server, you will receive the following error when trying to run the locate command:
Code:
warning: locate: could not open database: /var/lib/slocate/slocate.db: 
No such file or directory warning: You need to run the 'updatedb' command
(as root) to create the database.
Please have a look at /etc/updatedb.conf to enable the daily cron job.
You would simply run this command to correct that situation:
Code:
updatedb
Cron for updatedb

Normally, updatedb should automatically run daily as a cron update to ensure that the locate database is up-to-date. If this is not happening, you will receive the following error when you try to run a locate command:
Code:
warning: locate: warning: database /var/lib/slocate/slocate.db' is more 
than 8 days old
To fix the cron not running daily, you would need to go to /etc/cron.daily and edit the file slocate.conf which might have the following in it:
Code:
#!/bin/sh
. /etc/updatedb.conf
[ "$DAILY_UPDATE" != "yes" ] && exit 0
renice +19 -p $$ >/dev/null 2>&1
/usr/bin/updatedb
This command means it will not be yes (line 3 where it has != means not) for updating daily, so simply remove the ! in that line, which results in the following:
Code:
#!/bin/sh
. /etc/updatedb.conf
[ "$DAILY_UPDATE" = "yes" ] && exit 0
renice +19 -p $$ >/dev/null 2>&1
/usr/bin/updatedb
Save the file and then updatedb will run the next time the cron runs. You can see when the cron runs by looking at /etc/crontab file:
Code:
cat /etc/crontab
This will return output similar to the following:
Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
If you want to change the time when cron.daily runs, change the interval in that 02 4 * * * root run-parts /etc/cron.daily line. The existing one means it will run at 4:02am every day, every month, every day of the week.
__________________
Miraenda
~ Ex uno disce omnes ~
Reply With Quote
Reply

Bookmarks

Thread Tools

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 On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 14:25.


A vBSkinworks Design
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.