How to Schedule Sleep and Wake Events from Terminal in OS X
Like many of us, I’m often busy and out of the home, leaving my Mac on a desk. I regularly use my home machine as a local fileserver though and other people in the household are dependent on it being up and running. Now here’s the situation I’m presented with: I leave town earlier than my housemates do, but I don’t want to have to rely on someone who is not particularly computer savvy to put my Mac to sleep, so what do I do? Schedule the sleeping and waking events, of course!
Yes, most users should and can schedule sleep events from the Energy Saver preference panel in OS X, but this is aimed more at advanced individuals who, perhaps, want to adjust this behavior remotely, and that’s what the Terminal allows for. And, being a bit on the geeky side, I’ll do this from the command line, which serves two purposes:
1) it’s geeky
2) it is exactly what you could do if you are currently away from your Mac but want to schedule sleep and wake remotely.
Scheduling Mac Sleep & Wake Events from the Command Line in OS X
Here’s how you can schedule sleep and wake via the command line, remember you can do this remotely by SSH’ing into the Mac you want to schedule:
pmset schedule sleep "12/24/2009 00:00:00"
Now my system will go to sleep on Christmas Eve, the 24th of December.
pmset schedule wake "12/26/2009 00:00:00"
This command insures that my Mac wakes up the day after Christmas
That’s all there is to it! Now my Mac will sleep and wake on it’s own, independent of anyone else interfering with the machine. Note that you can do all of this through the Energy Saver GUI too but that’s not as fun (for me at least).