Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Create Spotlight indexes for networked volumes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Create Spotlight indexes for networked volumes
Authored by: JesperHansen on May 31, '05 08:37:06PM

Instead of polling each minutes, its now possible with Tigers new launchd to only run commands when a specific folder changes (like /Volumes).

Here is a small example of how I enable indexing when I mount my "stuff" smb volume.

Two files are involved, first a Launch Daemon config file:
/Library/LaunchDaemons/enableindexing.plist


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>enableindexing</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/enableindexing.sh</string>
        </array>
        <key>WatchPaths</key>
        <array>
                <string>/Volumes</string>
        </array>
</dict>
</plist>
This basically tells the daemon to run the script "/usr/local/bin/enableindexing.sh" when something in /Volumes is changed.

My "/usr/local/bin/enableindexing.sh" scripts look like this:


#!/bin/sh
sleep 1 # let things settle down a bit
if mdutil -s "/Volumes/stuff" | grep -q "Indexing Disabled" ; then
	mdutil -i on "/Volumes/stuff" >/dev/null
fi

If your smb volume is not called stuff, you might want to change the script a bit :)
The "sleep 1" line is enough on my machine (G5), but maybe a longer sleep is needed on a slower machine.
Also remember to run "chmod +x /usr/local/bin/enableindexing.sh"

To tell the Launch Daemon about this new script, either reboot or do "sudo launchctl load /Library/LaunchDaemons/enableindexing.plist"

[ Reply to This | # ]

10.4: Create Spotlight indexes for networked volumes
Authored by: rlaan on Jun 13, '05 08:11:52AM

Very interesting, but what happens if the volume is an automount that mounts on login? e.g. in a Workgroup Environment

Ruben

---
The box said, Windows 95 or better, so I bought OS X.



[ Reply to This | # ]
10.4: Create Spotlight indexes for networked volumes
Authored by: regulus on Jul 06, '05 05:08:45PM

You are KING! That works great!

This tip is so good it should be its own hint.



[ Reply to This | # ]
10.4: Create Spotlight indexes for networked volumes
Authored by: matteus on Jul 12, '05 04:10:05PM
This works great, and I can verify that my SMB shared files are indexed with:
mdls /Volumes/volumename/filename
However neither the spotlight menubar interface or mdfind searches the indices that contain these SMB volumes. This is a great tip to keep my SMB volumes indexed, but if I can't search these indices then what's really the point? Any help appreciated.

Thanks,
matteus

[ Reply to This | # ]
10.4: Create Spotlight indexes for networked volumes
Authored by: regulus on Jul 12, '05 04:27:18PM

To search on them you first cmd-f to bring up a find window and then click "servers"... that will search any mounted drives.



[ Reply to This | # ]