Is it possible to prevent a Mac from going to sleep immediately when a user chooses "Sleep" from the apple menu?
I'm aware of caffeinate -i
as a means of preventing automatic sleep (triggered via powerd
after the system sleep time set in the Energy Saver preference pane) however, when a user tells a machine to sleep manually it goes to sleep immediately. This is problematic however if it happens when running things like backups which will either be greatly delayed, or remote backups that can be interrupted and fail (lose the remote connection).
What I'd ideally like to do is change the behaviour of the apple menu "Sleep" command to instead be treated as "turn off display, sleep when ready" or just "turn off display", so that I can use caffeinate -i
to block full system sleep until certain processes have finished in all cases.
Is such a thing possible? And to clarify, I'm asking this because it's a system for a family member who just will not stop choosing sleep from the apple menu no matter how times I tell them to just turn off the display and let it go to sleep on its own; so yes, I guess I'm looking for a technical workaround to a problem user. 😂