Set different startup times for different days

Dec 30, '05 06:32:00AM

Contributed by: frijole

The Energy Saver preference pane only allows you one rule for automatic startup, so if you want to have the machine start at, say, 5:30am on weekdays, but not until 7:00am on weekends, you're out of luck. This is becuase the PMU can only store one pair of scheduled rules, one for shutdown/sleep and one for startup. You can, however, write directly to the rules via the pmset command line utility. So to enable scheduling two different rules, we're just going to set up a couple cron tasks to change the rule on Friday and Sunday.

For cron tweaking, I like CronniX. It's pretty straightforward, and makes it a little easier than firing up a command-line editor. Once you open CronniX, you should change to the root crontab, by using the File: Open User's Crontab menu itme, and then entering root as the user. It should ask you to authenticate, and then show that the current crontab is that of root.

Now we'll add two rules, one for Friday to change it to the weekend startup time, and one for Sunday to change it to the weekday time. I set these to run at noon on both days, or you may prefer to have them run about 10 minutes after the scheduled boot for that day, to make sure the system isn't aleep when it's time to run them. Here's the command to use to set the schedule:

pmset repeat type weekdays time
Here's what each argument means: So bringing this all together, I used the following two commands, the first on Friday, and the second on Sunday:
pmset repeat wakeorpoweron SU 7:00:00
pmset repeat wakeorpoweron MTWRF 5:30:00
This screenshot shows what my CronniX looked like when I was done.

This same method could be applied to setting startup times to be different for different periods, just by changing the day/time of the command, as well as the cron task to run the day before the change is to take effect.

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2005122507424492