[lug] slocate.db.stf

D. Stimits stimits at comcast.net
Sat Dec 30 12:44:26 MST 2006


Ben wrote:

>Thanks for all the help with my slocate.db.stf error message. As I test,
>I moved cron.daily to run at a different time and it ran without errors.
>So, I moved it from 6:25am to 5:25am (edit crontab, restart cron). The
>cron ran at 5:25am without any errors and made a log in my syslog. But
>at 6:25am I get the same error message:
>
>Subject: Cron <root at agnew> test -x /usr/sbin/anacron || run-parts
>--report /etc/cron.daily
>
>/etc/cron.daily/slocate:
>updatedb: fatal error: The temp file '/var/lib/slocate/slocate.db.stf'
>already exists and does not appear to be a valid slocate database.
>Please remove before creating the database.
>
>I looked through syslog and nothing happened at 6:25am. So what is
>causing cron.daily to run at 6:25am and is it coincidence that that is
>the same time I *was* running cron.daily? And why doesn't it log
>running?
>
>Thanks,
>  
>

If you use fuser on a file that's currently being accessed, it'll tell 
you the pid. So if you run slocate by hand and you "fuser 
/var/lib/slocate/slocate.db.stf", it'll reply with a pid, and then you 
can use that in "ps aux | grep <pid>" to see the winner. Looks like if 
you're there at the time, you can figure out what's running it that way 
(using ps fax might be more informative and then look for the pid).

You could even make a shell script to do this, with logging of the pid 
and ps, and put that into cron at the same moment that it runs, and 
before and after by 1 minute...the problem will be if it dies instantly 
before you can run fuser on it. If that happens, you could create a 
script with an infinite loop to poll constantly via fuser on that file 
name, and then output the answer if there is a valid answer (and then 
exit or simply remember the answer and not repeat the answer unless the 
answer changes).

D. Stimits, stimits AT comcast DOT net



More information about the LUG mailing list