Skip to content

Instantly share code, notes, and snippets.

@therealFoxster
Created August 11, 2022 09:44
Show Gist options
  • Save therealFoxster/1930c9e6c0423a16688cfbe04ca4c566 to your computer and use it in GitHub Desktop.
Save therealFoxster/1930c9e6c0423a16688cfbe04ca4c566 to your computer and use it in GitHub Desktop.
A fix for SendLaterDelivery causing high CPU usage (powerd) on macOS 13.0 beta. Tested on 13.0b5.
#!/bin/bash
while true; do
idle=10 #minutes
echo -n "${WBOL}[$(date +'%H:%M')]${WDEF} checking pm schedules; "
sched=$(pmset -g sched)
if [[ $sched != "" ]]; then
echo -n "found schedule(s); cancelling all; "
if pmset schedule cancelall; then
echo -n "cancelled all schedules; "
else
echo -n "unable to cancel all schedules (an error occurred); "
fi
else
echo -n "no schedules found; "
fi
echo -en "next check @$(date -v+${idle}M +'%H:%M');\n"
sleep $((60*$idle))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment