multiple wake-up times with pm set

Hello, I have a question. I have 2 workflows that I have built through automator. I want them to start everyday at 4:00 and the other one to start at 22:00. The problem is that at those times, my mac would be asleep (or completely off) and automator would not run in those scenarios. I know the energy saver under system preferences has an option to wake up the computer but the problem is that it only gives me 1 option. So, I can either turn it on at 3:58 or at 21:58. I need to figure out how to get multiple wake up times for the mac (without purchasing any software).

I have read some things on the internet about Pm set that would allow you to accomplish that. The problem is that I don't know how to use it. Is there a way to safely set this up with pm set? I have opened the terminal but I don't know how to use it. any help would be appreciated.


Thanks.

By the way, I am using the latest Imac model 2.7 GHz Intel Core i5 with OSX 10.8.3

iMac (21.5-inch, Late 2012), OS X Mountain Lion (10.8.3)

Posted on Jun 2, 2013 6:20 AM

Reply
9 replies

Jun 2, 2013 6:45 AM in response to alex fromparker

The pmset command will wake and sleep the system on a schedule, but you can only set one such event per day. One option with this is to have it wake at 22:00 and then sleep after 4:00, but it would remain on during this time frame.


The alternative would be to have a script run through your workflow that would execute pmset and update the schedule, but this could get a bit convoluted to set up. pmset requires running as root to modify any settings, so you would have to authenticate, perhaps set it to run as a root-level launch agent, or modify your sudoers file (not recommended) to modify the authentication requirements for the sudo command for a given user.

Jun 2, 2013 7:17 AM in response to alex fromparker

True and untrue at the same time.


You can set up multiple schedules, but not multiple repeat events. Therefore, if you want the system to wake on July 12th, and then on July 15th, or even on July 12th at 8:00am and then on the same day at 9:00pm, then you can do that with a repeated schedule. However, you cannot do this for an indefinitely repeating event such as having the system always wake or sleep on every Tuesday moving forward.


One way to do this would be to script a schedule for the current week or month, and then apply it, but this setup would require regular maintenance to keep the schedule going.

Jun 2, 2013 7:18 PM in response to alex fromparker

Does it have to run at exactly 0400 and 2200, or can it run after it wakes from sleep after that time?

If that is the case, you may want to look at creating a launchctl plist to have it run whatever you want at those times. launchd will run them as soon as it wakes up after the scheduled time (or at that time if it is awake).


There are quite a few examples online, but Lingon makes it pretty easy to create the plist and schedule the events. Even with Lingon, you would want to read up on launchd: http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystem Startup/Chapters/CreatingLaunchdJobs.html


An example using Lingon: http://nathangrigg.net/2012/07/schedule-jobs-using-launchd/

Jun 6, 2013 7:13 PM in response to Barney-15E

@ Barney

Yes that launchd I believe is to creat a task, but will it run when the computer is asleep? the problem I am having is that I want to wake up the computer twice a day. The task I want to run by the way is to turn the wifi internet sharing on in the morning and off at night, everyday. I can accomplish that with automator without any problem, as long as the computer is on and not asleep. That's why I want to figure out how to wake it up twice automatically, for example to wake up at 5am in the morning and set up automator to run automatically at 5:05am and then the computer falls asleep again after 10 minutes of inactivity anyway.


@ Topher

I'll keep digging more into the comments on that link I sent you. Do you know of a good tutorial to learn how to use terminal? I've read it is not something one should mess with.

Jun 6, 2013 10:33 PM in response to alex fromparker

The Terminal is not something to blindly avoid; it's just a more complex approach to managing your system, which requires syntax (somethign that is not needed for graphical interfaces), so small errors like typos can result in commands not working.


Usually these errors simply give a warning instead of performing the intended task, but in rare cases they can lead to data loss or system destability. The OS X graphical interface has a number of checks to keep you from deleting or modifying important files, but many of these are not implemented in the Terminal.


There are a number of tutorials on the internet that you can search for and try out. Most will get you started on the basics just fine, with the differences only being for more advanced users. Once you know how to navigate your system with the Terminal, then you can advance to viewing and editing files, looking up information like permissions, and then modifying system files to make changes, if needed.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

multiple wake-up times with pm set

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.