How do I schedule pmset wake for a cron job?

My MacBook cron job is not running, although I have pmset set to be awake.


Any idea why?


1 0 * * 1-5 /usr/local/Cellar/php@7.4/7.4.28/bin/php /Users/robertseymour/MacBook_Local/scripts/twitterOauthwithImagePost/twitter.php


sudo pmset repeat wakeorpoweron MTWFR 00:00:00


Thanks!

Robert

MacBook Pro 13″, macOS 13.2

Posted on Feb 7, 2023 1:51 PM

Reply

Similar questions

11 replies

Feb 7, 2023 5:02 PM in response to Camelot

Camelot wrote:

> BTW What is the expected pmset wake duration once executed?

Indefinitely - at least until what other controls you have in place to put the system back to sleep.

In other words, there is no expectation that pmset wake will wake your machine for any specific period of time - it's no different from you hitting the keyboard to wake your machine - it will say away until what other power management settings you have (such as idle time) tell the system to go back to sleep.

If you want the system to go back to sleep when the job is done, add that to your script, or add another cron/launchd task to do it for you.


I'm waking a headless Mac-mini and I don't think I have any way to keep it awake other than ssh and running caffeinate. I've tried having launchd on the mini run caffeinate, but it doesn't seem to work. I would think that it should, but last I tried, it didn't work. I may look into this again.

Feb 7, 2023 4:28 PM in response to rseymour

> BTW What is the expected pmset wake duration once executed?


Indefinitely - at least until what other controls you have in place to put the system back to sleep.


In other words, there is no expectation that pmset wake will wake your machine for any specific period of time - it's no different from you hitting the keyboard to wake your machine - it will say away until what other power management settings you have (such as idle time) tell the system to go back to sleep.


If you want the system to go back to sleep when the job is done, add that to your script, or add another cron/launchd task to do it for you.

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.

How do I schedule pmset wake for a cron job?

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