Skip navigation
This discussion is archived

Verify if Spotlight is indexing

1979 Views 8 Replies Latest reply: Jul 28, 2008 4:14 PM by Antonio Rocco RSS
Tohu Calculating status...
Currently Being Moderated
Jul 21, 2008 6:51 AM
Hello.

is there a way to verify if sotlight is indexing at the moment within Apple Script? Maybe even if it is indexing an given Volume?
Mac OS X (10.5.2)
  • red_menace Level 6 Level 6 (14,275 points)
    Currently Being Moderated
    Jul 25, 2008 4:04 PM (in response to Tohu)
    The metadata server and worker processes are always running. You might try checking the cpu usage of the mdworker process, or the modification date of the Spotlight database on the particular volume.
    MacBook Pro, Mac OS X (10.5.4), /  G4 Digital Audio, G4 mini [Tiger 10.4.11]  /  G3 MiniTower [OS 9.2]
  • Andrew99 Level 4 Level 4 (1,300 points)
    Currently Being Moderated
    Jul 26, 2008 8:59 AM (in response to Tohu)
    Tohu,

    The code below would need to be saved as a stay-open application...

    *on idle*
    *tell application "System Events"*
    *do shell script "ps -Aco command"*
    *if result contains "mdimport" then*
    *display dialog "mdimport is running..." buttons {"OK"} default button "OK"*
    *if button returned of result is "OK" then*
    *quit me*
    *end if*
    *end if*
    *end tell*
    *end idle*

    Since it's likely that mdimport is not currently running, you can test the script using any of the currently running processes, visible or not, found under All Processes in Activity Monitor, by replacing each instance of "mdimport" with the name of another running process. Also test the script using a readily available application currently not running by replacing "mdimport" with its name. Launch the script, wait a bit, and launch the application named in the script. The dialog telling you the app is running should appear within 30 seconds. Pressing "OK" will quit the script within 30 seconds.

    That said, you might consider whether keeping a stay-open script app running is worth the bother. Might be easier just to check Activity Monitor periodically. Good luck.

    Regards, Andrew99
    iMac 1 GHz Flat Panel 15" PPC 768 MB RAM Imation SuperDisk, Mac OS X (10.4.11)
  • red_menace Level 6 Level 6 (14,275 points)
    Currently Being Moderated
    Jul 26, 2008 10:17 AM (in response to Tohu)
    The mdworker process is what scans and indexes file as a volume is mounted, but it is always running (just more at times). Each volume that is indexed has a Spotlight database file on it - it is normally invisible, but the normal methods to get information about the various file (such as modification dates) can be used.

    What exactly are you trying to do? There may be another approach.
    MacBook Pro, Mac OS X (10.5.4), /  G4 Digital Audio, G4 mini [Tiger 10.4.11]  /  G3 MiniTower [OS 9.2]
  • Antonio Rocco Level 6 Level 6 (10,100 points)
    Currently Being Moderated
    Jul 28, 2008 4:14 PM (in response to Tohu)
    Hi

    Have you looked at mdutil? Consult the manual for usage: man mdutil.

    Tony

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.