PDA

View Full Version : "Undocking" application?


torifile
2011-03-16, 21:57
I now have my MBA connected to my ACD with an external drive attached. That drive has my media on it so when I'm docked, at the office, I can just connect my iPhone/iPad and sync. The problem with this setup was the quitting of iTunes and iPhoto and ejecting the disk prior to sleeping the computer to undock it. It's trivial, I know, but tedious.

So, I created a little Automator application that quits iTunes and iPhoto, ejects my external drive and sleeps my computer so that I can undock it quickly. That works well enough when only those 2 apps are using the drive, but tonight I got home with the error message saying that the disk was disconnected improperly. And below that was a dialog saying that the disk couldn't be ejected because it was in use by Marsedit. Problem is that I didn't see these warnings because the computer had gone to sleep. Nevermind that ME should not using the disk - I'll figure that one out later - but I'd like to see if there's a way to automatically quit any application that's using the external.

Any thoughts on how to make this happen? I'm not wedded to an Automator script; I like it because it's easily launchable, but I'm open to alternate methods. TIA.

Frisco
2011-03-31, 08:03
This terminal command lists any open files on the volume "BACKUP" along with their associated applications.

lsof | grep /Volumes/BACKUP

Parsing the output and force-quitting the offending apps are left as an exercise.