2

Can I use pmset or a utility like Power Manager to have a task (such as an arbitrary script or backup) run at a specific time while my Mavericks MacBook Pro's lid is closed? Are there perhaps pmset settings I need to change to make such a thing work?

  • does Power Nap not do what you want? (you mentioned only backup which it does do) – Brad Allred Nov 27 '13 at 19:33
  • @BradAllred: I thought PowerNap only did the Apple things listed, not tasks users can add. – orome Nov 27 '13 at 19:37
  • correct, but you only mentioned backup so I thought i'd mention it. – Brad Allred Nov 27 '13 at 19:38
  • @BradAllred: Ah, yes. I mean non-Apple backup software, for example. – orome Nov 27 '13 at 19:45
1

While the lid is closed, a pmset wake will only wake up your machine very briefly, after which it will go back to sleep again. To keep the machine awake long enough to preform a task, you can caffeinate the machine for the amount of time (in seconds) you expect the task to take. For example, to keep the machine awake for 2 minutes, simply add

caffeinate -t 120 &

early on in the script that runs your task.

Alternatively, caffeinate has options for tying the duration of the forced wake period to the completion of the task, but this runs the risk of keeping the machine awake indefinitely, so a safer bet is this expected-time-based approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .