mercredi 18 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.


Update: To answer Buscar's question. When I run pmset -g I see the following:



Active Profiles:
Battery Power -1
AC Power -1*
Currently in use:
standbydelay 4200
standby 1
womp 0
halfdim 1
hibernatefile /var/vm/sleepimage
darkwakes 0
networkoversleep 0
disksleep 10
sleep 180 (sleep prevented by UserEventAgent)
hibernatemode 3
ttyskeepawake 1
displaysleep 10
acwake 0
lidwake 1




Aucun commentaire:

Enregistrer un commentaire