Created
December 17, 2022 15:24
-
-
Save rtanikella/7d695a6aace24cf362ee6a1b69320182 to your computer and use it in GitHub Desktop.
A shell script to list events in the macOS to list out sleep and wake events. This might be out-of-date with current versions of macOS (Monterrey/12.6.1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
log show --last 24h | grep -e "System Sleep" -e " Wake reason" > /tmp/sleep-wake-hist.txt | |
pmset -g log | grep -e " Sleep " -e " Wake " >> /tmp/sleep-wake-hist.txt | |
sort -o /tmp/sleep-wake-hist-sorted.txt /tmp/sleep-wake-hist.txt | |
echo -n `wc -l /tmp/sleep-wake-hist-sorted.txt` log lines found | |
cat /tmp/sleep-wake-hist-sorted.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HInts to myself for improvement:
Log lines like this one might indicate the closing of the laptop lid: '[HID] [ATC] AppleDeviceManagementHIDEventService::processWakeReason Wake reason: Keyboard (0x02)
2022-12-17 00:27:21 -0500 Sleep Entering Sleep state due to 'Clamshell Sleep':TCPKeepAlive=active Using Batt
(Charge:74%)'