Power Management


Since various Apple hardware has different Power Manager capabilities, it's not recommended to include Energy Saver settings in an OS X image. How then to manage Energy Saver settings? pmset to the rescue!

Even Mike Bombich's excellent Carbon Copy Cloner removes Energy Saver settings when it is building an image of an OS X installation. So Energy Saver settings may not be consistent among your managed machines. If you run tasks automatically at night, it may be important to ensure your machines never go to sleep. If you have color-calibrated displays, you may need to ensure the displays never dim or sleep (as this can affect color calibration).

Enter pmset - a command-line interface to the Energy saver settings. Type man pmset at a command prompt for the complete tour.

Here's how I use it:

##################################################################
# Power Management
##################################################################
# -c flag means wall power, so this does not affect battery settings
# sets sleep never, disk spindown 10 mins
# and turns on wake on administrator network access
echo "Configuring Power Management options"
pmset -c sleep 0 spindown 10 womp 1

# if dim time is less than 30 minutes, set it to 30 minutes.
# (Again does not affect settings when running on battery)
dimtime=`pmset -g | grep dim | awk '{ print $2 }'`
if [ $dimtime -lt 30 -a  $dimtime -ne 0 ]; then
    #set dim time to 30 minutes
    echo "Setting display dim time to 30 minutes"
    pmset -c dim 30
fi

This script is called at startup as part of a custom StartupItem.

It leaves any Energy Saver settings that are for use when the machine is running on battery alone, though you could certainly script those as well, if you wanted. It sets the machine to never sleep, spin the hard drive down after 10 minutes of idle time, and turns on "wake on administrator network access" (which I have yet to put to good use).

Next, it sets the display to dim after 30 minutes, unless the user has set the time to an even greater value.

Posted: Wed - November 12, 2003 at 10:13 PM      


©