Is it possible to detect Power Nap / DarkWake mode in OSX

这一生的挚爱 提交于 2019-12-04 06:37:25

Just needed to find out about these wakes too. Using the log utility, I can see these lines when the system wakes up on its own (even without powernap activated):

2019-04-11 22:18:00.622600+0200 0x250 Default 0x0 83 0 powerd: [powerd:sleepWake] vm.darkwake_mode: 1 -> 1

2019-04-11 22:18:00.625413+0200 0x250 Default 0x0 83 0 powerd: [powerd:sleepWake] DarkWake from Deep Idle [CDN] due to RTC/Maintenance:

In order to detect this, something like this should work:

log show --last 1m --predicate 'subsystem == "powerd"' | grep "DarkWake from Deep Idle"

Alternatively, using caffeinate in your script might work too (haven't tested this yet).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!