Create multiple unique wake schedules

The OS X Energy Saver panel contains a Schedule button that lets you set a start/wake and sleep schedule for your machine. You can set the schedule for a particular day of the week, all weekdays, weekends, or every day. What you cannot do, however, is set more than one schedule. So if you use your Mac as an alarm clock and want to wake at 8:30 a.m. on the weekends but at 5:30 a.m. on weekdays, you’re apparently out of luck.

However, using a couple of Unix programs, you can effectively create any number of sleep/wake schedules. The two commands we’ll be using are cron, which lets you schedule events to occur on a given schedule, and pmset, which is the command line interface to the Mac’s power management system. To make the process just a bit simpler (editing cron files isn’t really all that much fun), we’re also going to use Cronnix, a free application (donations accepted) that makes working with cron files much simpler.

For the purposes of the example, I’m going to set up the Mac to wake up at 5:00 a.m. on weekdays, and at 8:30 a.m. on weekends. Obviously you can use whatever combination of days and times you like. The first thing to do is download and install Cronnix and launch it. When the Cronnix window appears, select File -> Open for User, and enter root in the drop-down box that appears. Click Open, and you’ll be asked for your admin password, and you might see a warning about an empty crontab for root (just click OK). Now click the New button in the toolbar.

Before we do anything else, here’s a little bit about exactly what it is we’re going to do. The reason you can only have one sleep or wake schedule is that the Mac’s power management unit can only remember one schedule. So we’re going to use cron (via Cronnix) to change our schedule twice a week—once on Sunday, to activate the “weekday” wake-up schedule, and then again on Friday, to activate the weekend wake-up schedule. We’ll use pmset to actually create each schedule, and that’s the command that cron will run for us each day. If you’d like more information on what you can do with pmset, open Terminal and type man pmset; it really is quite powerful, but you’ll have to work with it via Terminal, as it has no GUI.

Back to Cronnix now. On the sheet that dropped down, make sure you’re looking at the Simple tab. We’ll set up the Sunday schedule change first. Drag the Minute and Hour sliders to a time when your Mac is typically awake. (I chose 11:30 a.m.) Leave Day of Month and Month as they are, and for Day of Week, check Sunday, and make sure none of the other boxes are checked. In the Command box, enter this text:

pmset repeat wakeorpoweron MTWRF 5:00:00

The above command is what does the work. pmset is called with the repeat option (which sets a recurring schedule), and the wakeorpoweron means that the schedule will apply to those type of events. Finally, the MTWRF 5:00:00 section sets the 5:00am Monday through Friday schedule. (All of this is explained in detail in the pmset manual; use man pmset in Terminal to read it.) Click the New button when you’re done, and you’ll be taken back to the main Cronnix screen.

Now click the New button in the main Cronnix toolbar again, go to the Simple tab, set the Minute and Hour sliders, and then set the Day of the Week to just Friday—this event will hold our weekend schedule. In the Command section, enter this text:

pmset repeat wakeorpoweron SU 8:30:00

As before, this command sets up a new schedule, in this case applying to only Saturday and Sunday. Click New when you’re done, and you should see something like this in the Cronnix display:

Click the Save button, enter your admin password again, and you’re done. Your machine now has, effectively, two separate wake schedules. What it really has, of course, is one active wake schedule at a time, and an automated method of switching between them as time goes by. So even when the system seems to make something impossible, often times you can get it done using nothing more than the tools provided by that same system (the use of Cronnix here is for ease, not because it’s required). Pretty cool!

Shop Tech Products at Amazon