We’ve got a variety of Macs running OS X versions 10.4, 10.5 and 10.6. They’re all managed from an Xserve with MCX preferences through Workgroup Manager, but for some reason I’ve just never managed to get them all to settle nicely with their power management settings.
While it’s lovely to have the control of these things through Workgroup Manager, I finally got miffed with it not working, particularly with the Tiger clients. It’s also not good to have rooms of machines burning away power and their components pointlessly.
So I did what I usually do. Write a script. There’s an excellent blog called Managing OS X which had already covered this issue, so using GregN’s script as inspiration I came up with this, in Perl for some reason.
The idea is that this runs via launchd however often you would like. Using Lingon to create a
.plist file, I have it triggered every hour. It uses the hostname of the machine to determine where it is, with different rules applied if the system is a ‘cluster’ or a ‘studio’ machine. Once per boot it reapplies the power management policy, and on every run it examines the state of the machine and decides whether it should be powered down.
Lifted straight from GregN’s script is the idle time discovery; this is perfect for testing whether someone is using a machine ‘out of hours’ and not shutting it down prematurely if they are. :)
One extra feature in this script is the processor usage check. As we occasionally farm out jobs via Xgrid or Logic Node, it’s not good to turn off while processing something. While I wouldn’t say that this bit has been extensively tested, it does seem to work pretty well for us at the moment.