Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Set different startup times for different days' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set different startup times for different days
Authored by: krunk7 on Apr 21, '08 06:31:40PM

To expand upon the suggestion above, you could write a script which set the schedule for the following week and put that in your cron to run weekly.

A script that set two wakes (6:30am and 5:30pm) and two sleeps (9am and 10:30pm) for each day would look something like this: (ruby)


def build_schedule(wake, shutdown)
  days = {'Sunday' =>, 
          'Monday' =>,  
          'Tuesday' =>, 
          'Wednesday' =>,
          'Thursday' =>,
          'Friday' =>, 
          'Saturday' =>}
  t =
  t = t + (60*60*24)
  days.each do |k,d|
    days[t.strftime('%A')] = [t.strftime("%m/%d/%y #{wake}"), t.strftime("%m/%d/%y #{shutdown}")]
    t = t + (60*60*24)

sched1 = build_schedule("6:30:00","9:00:00")
sched2 = build_schedule("17:30:00", "22:30:00")

[sched1,sched2].each do |s|
  s.each do |k, v|
    wake = "pmset schedule wakeorpoweron '#{v[0]}'"
    shutdown = "pmset schedule shutdown '#{v[1]}'"

[ Reply to This | # ]