0
I'm running archive utility on an iMac to extract thousands of files so it takes a long time. I will also be running a process in a program called R Studio that may take several days to complete. I need to find a way to keep the system from going to sleep and pausing these processes.
I believe the caffeinate command in terminal is the solution, but I am having trouble getting it to work they way I want it to.
I read the caffeinate man page and tried caffeinate -w [PID]
which appeared to work as long as the display is on. Once the display turns off, the system pauses the process and goes to sleep anyway.
I also thought about trying caffeinate -s [utility]
but per this webpage: http://osxdaily.com/2014/06/16/caffeinate-prevent-sleep-while-command-active-mac-os-x/ I need to specify the full path to the binary for the utility within the .app file and I'm not sure what that path is for either the extract process in Archive Utility or the process I'll be running in R Studio. Using the PID, which I can find in the Activity Monitor once the process has started, seemed more reliable.
I have read this related Q&A on superuser: Keep Mac running with display off However, I'm looking for a more targeted solution than what was suggested: caffeinate -s
. My understanding is that the -s prevents the system from sleeping until caffeinate exits. I'd really like a solution that allows caffeinate to exit automatically when the process is done.
And I'm also really curious why the caffeinate -w assertion stops working when the display turns off.
NEW Q: My process finished its run but caffeinate didn't seem to exit as expected. What am I missing? and how do you terminate caffeinate other than quitting terminal? I've tried exit caffeinate
but that didn't seem to do anything.
Thanks!
My last Mac Pro, bought in 2008, never slept in 10 years, it ran 24/7/365 rebooting only for OS updates until it finally gave up the ghost last year. What's wrong with 'computer sleep = never' in system prefs>energy saver? – Tetsujin – 2019-04-27T16:33:21.777
That was my solution for my MacBook too. And when the process finished I changed the setting back. But I don't seem to have that option on the iMac. Also, I would really prefer to have it sleep when the process is finished. Seems caffeinate should do this, but I'm not getting expected behavior and want to know why. – ESELIA – 2019-04-27T18:58:12.377