Last active
June 27, 2024 09:27
-
-
Save nielsole/7b5a217ae2bb8fa54626f58b736feb91 to your computer and use it in GitHub Desktop.
Thermalert continuously monitors temperature of a mac.
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/bash | |
while true; do | |
# Get the current CPU_Speed_Limit value | |
CPU_SPEED_LIMIT=$(pmset -g therm | grep "CPU_Speed_Limit" | awk '{print $3}') | |
# Check if CPU_Speed_Limit is less than 80 | |
if (( CPU_SPEED_LIMIT < 80 )); then | |
# Send notification | |
osascript -e 'display notification "CPU Speed Limit is below 80%: '"$CPU_SPEED_LIMIT"'%" with title "CPU Speed Alert" sound name "Funk"' | |
else | |
echo "No thermal throttling detected: $CPU_SPEED_LIMIT" | |
fi | |
# Wait for a minute before checking again | |
sleep 60 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment