I have a global launchd plist file that runs a backup script periodically. The script is a pretty simple bash script that sets up some variables and calls duply
. However the plist doesn't seem to be preventing the system from going into sleep mode.
Is there a way of preventing the mac from going into sleep mode whilst this specific launchd plist and associated script are running?
The solution that seems to be working is
caffeinate -s [utility]
This forces the system to stay awake until the
[utility]
closes.The full man page explains more.
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/caffeinate.8.html