0

I use sudo /usr/libexec/locate.updatedb on Mac OS X when I am too impatient to wait for it's scheduled script to kick in and run, which I believe is only once a month.

Mac OS X doesn't use cron/other schedulers, but instead ( at least pre Yosemite ), launchd is used, which is like cron only more granular w/ more options, at the expense of a bit of over verbosity in my humble opinion.

Researching, I found this website which states that the below code is:

...In a moment of glorious chance, I happened to come across this handy little bash script and I nearly palmed my face clean off because I hadn't thought of it.

pushd . > /dev/null
cd /usr/libexec
echo "Updating locate database..."
sudo ./locate.updatedb
echo "Updating complete!"
popd > /dev/null

Can someone walk me though this, I have read the man page on each, but don't see the advantage. If you /usr/libexec before running ./locate.updatedb I fail to see why you would need the above script. It seems like a bit of overheard to manage another file, in your PATH, when you can just cd into the executable and go from there.

Scott
  • 571
  • 1
  • 4
  • 12
  • I believe the gist of the blog post is that the author is used to the command `updatedb` and writing a script lets him use that command specifically. – JJJ Nov 09 '14 at 09:11

1 Answers1

0

Thanks. I couldn't figure out the advabtage. So this is just a convenience script for his workflow. Any method that fires off the update script will suffice.

His script just makes sure you are in the correct cwd

Thank you for the input.

Scott
  • 571
  • 1
  • 4
  • 12