Solved Locate database not updating

It is found that locate database is not updating. Log of cron shows all but periodic output. There are no log files for daily,weekly & monthly.This is my system for home use. Am I missing something in default settings or to modify some config?
 
What FreeBSD version are you running? That could be tied into this.

Alas, things to look out for. First be aware that the locate update only runs once every week, not every day. So don't set your expectations too high.

Check /etc/crontab and verify that it has these entries:

Code:
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
Next check if the file /etc/periodic.conf exists and if it doesn't contain anything weird. Also applies to /usr/local/etc/periodic.conf. And ensure yourself that you didn't do something silly such as editing any files in /etc/defaults (that's a huge no no).

Next check that the file /etc/periodic/weekly/310.locate actually exists.

If all of that checks out then very that cron is actually running: # service cron status.

If this still didn't reveal anything then you have another problem on your hand. Does /bin/sh actually exist? And does it actually work: /bin/sh? Maybe verify with ldd /bin/sh.
 
Dear gnath,
I assume that you do not run your PC 24h per day because it is for home use. For my system it is similar. You could run /etc/periodic/weekly/310.locate manually. If you want to update the database automatically you could make a script triggering the update, may be update each Sunday or if the database is one or two weeks old or whatever. On my system I run a script as root at reboot as below (and modified slightly) according to root's crontab.
Code:
root@mycomputer # crontab -l
MAILTO=myaccountToSeeTheResult
@reboot /somewhere/script.sh
The conditions when to update should be within the script. To run the real update you could copy things out of /etc/periodic/weekly/310.locate to your script /somewhereelse/otherscript.sh. May be this is a useful idea.
 
Back
Top