Schedule multiple wake up times for Mac?
Solution 1:
Sorry, I only know command-line tools to do the job.
You can use pmset
for that (like in pmset schedule wake "02/12/2012 12:42:00"
).
More explanations here and, of course, man pmset
.
Setting Multiple "Power On" & Power Off" Events
Currently, it appears that pmset will NOT allow you to set more than one pair of "power on" & "power off" events when using a repeating schedule.
For example...
# pmset repeat shutdown MTWRFSU 02:00:00 wakeorpoweron MTWRFSU 06:45:00
The above command would set a repeating schedule that would shutdown the Mac nightly at 2 AM in the morning and startup daily at 6:45 AM.
But, if you want to set multiple "power on" & "power off" events, you could specify a specific date/time and with a little scripting you could setup a schedule for a month.
# pmset schedule wakeorpoweron "06/07/2007 07:00:00"
# pmset schedule shutdown "06/07/2007 22:00:00"
# pmset schedule wakeorpoweron "06/07/2007 00:00:00"
# pmset schedule shutdown "06/07/2007 01:00:00"
Solution 2:
You can use cron to change the wake up time using pmset. E.g., say you want to run script1 at 1 am and script2 at 3 am. In root's crontab:
0 1 * * * /path/to/script1
0 1 * * * pmset repeat shutdown MTWRFSU 01:01:00 wakeorpoweron MTWRFSU 02:59:00
0 3 * * * /path/to/script2
0 3 * * * pmset repeat shutdown MTWRFSU 03:01:00 wakeorpoweron MTWRFSU 00:59:00
When script1 is run, cron runs pmset to shutdown in 1 min and wake up when it is time to run script2. Likewise when script2 is run, it sets back up for script1.
Chaining your cron jobs this way would be equivalent to using multiple wake up times.
Solution 3:
This article, How to Power On Your Mac at a Specific Date and Time, shows how to schedule your Mac to power on using Energy Saver, pmset
, and Power Manager.
The most capable method is with Power Manager; it can schedule the multiple power on and wake up events you need using the Graphical User Interface (GUI).
Power Manager supports Mac OS X 10.6 and later, but the previous version is still available and supports Mac OS X 10.4 - 10.7 for PPC and Intel.
Disclosure: I work for the company who makes Power Manager.
Solution 4:
Chaining CRON jobs to power-on like user66309 suggested would be the best solution. But to ensure that the first CRON job actually runs, you need to add an @reboot CRON job to schedule the first wakeorpoweron event.
# the first wake or power on event is scheduled just before midnight
@reboot pmset repeat wakeorpoweron MTWRFSU 23:59:00
# schedule script1 for 1 minute past midnight
# keep computer awake as long as script1 is running
1 0 * * * caffeinate -i path/to/script1
# wake or power on computer a few minutes before script2 is scheduled
1 0 * * * pmset repeat wakeorpoweron MTWRFSU 11:59:00
# keep computer awake as long as script2 is running
1 12 * * * caffeinate -i path/to/script2
# wake or power on computer a few minutes before script1 is scheduled
1 12 * * * pmset repeat wakeorpoweron MTWRFSU 23:59:00
As an additional suggestion, I wouldn't schedule a shutdown or sleep event. Instead I'd run the script with caffeinate -i
. This way the computer stays awake for as long as the script needs, and afterwards the system settings for sleeping take effect. This way your computer won't shut down while your working on it.