The purpose of this script is to add a bit of granularity and intelligence to the energy saver settings in Mac OS X for disk sleep.
Problem: I want to let my disks sleep, but I HATE having to wait for a spinup while I’m working.
Solution: Allow the disks to spin down only when I’m not at the computer, and disable disk sleep while I’m at the computer. The mechanism for twiddling the disk sleep settings is the pmset tool.
This all works pretty much as described, with one caveat. Disks that are spun down when disk sleep is *disabled* (such as when you come back after an idle period) do not immediately spin up. Once accessed, they spin up and stay spun up until you go idle again. So, using this script, you may occasionally have to wait for a spinup, but never more than once per disk, per session.
Here is the script, and here is a launchd plist for it.