dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X

Home Page:http://www.controlplaneapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Action: adjust disksleep setting

andrew-hill opened this issue · comments

I know this was kind of mentioned in #50 (energy settings in general), and it was suggested that disk sleep was not very interesting or useful, but I have a use case for it, and think it's worth at least a re-consideration.

At work I plug into a RAID array, multiple mechanical disks which are quite slow to spin up. I use them intermittently through the day, but that's not so much a problem just when I want to use them directly, but at least once an hour, when I go to an open/save dialog or sometimes even just while browsing, various apps will completely lock up (pending disk access) while the RAID array spins up. I think it's a problem with OS X, there's no real reason why Chrome should need to wait for the disks to spin up in order to let me keep browsing, or even why a file Open/Save dialog should hang if one drive is not yet available... but that's the way it seems to be.

I'd like to just run sudo pmset -c disksleep 60 whenever that array is plugged in to avoid this, but it needs root privileges. Even leaving that setting always enabled (which is a bit of a waste of battery and maybe not great for my other disks elsewhere) would probably be OK, but the system seems to occasionally reset this parameter back to the default 10, so a regular forced setting would be good.

I recommend writing a script to handle this for you. First you'll need to setup sudo to allow your user to run pmset without a password with sudo visudo to edit the sudo file. Add a line like this, use your username

username ALL=(ALL) NOPASSWD:/usr/bin/pmset

Now you can create a pair of wrapper scripts you can call with the shell script action.