vendredi 13 mars 2015

caffeinate with launchd Doesn't Work when I Close My Laptop's Lid


I have a launchd task that periodically initiates a time machine network backup. I've had problems with corrupted sparse bundle disk images, which I've assumed is due to the either the computer sleeping during a backup, the NAS sleeping while the sparse bundle is mounted, or some combination of the 2. So, in order to fix this I run caffeinate with launchd task and have caffeinate run my script. I found, however, that the computer still goes to sleep when I close the lid, even when AC power is connected. I did a simple test, and found that caffeinate works as expected when I use it in a terminal, and does keep my computer awake, however, in that same test initiated with launchd/caffeinate the computer still goes to sleep while the script is running.


I'm running caffeinate with the -ims flags. In my simple test I used the following script:



#!/bin/sh

while true; do
date | logger
sleep 1
done


I monitor the system log with:



tail -f /var/log/system.log


I'm using OS X 10.9.5.





Aucun commentaire:

Enregistrer un commentaire