Created
June 20, 2018 18:15
-
-
Save wilm0x42/a4d12fc57b81c8e97bc144eeb739cfec to your computer and use it in GitHub Desktop.
A script to prevent overheating on thinkpads
This file contains 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 | |
tempHigh=false; | |
while [ true ]; do | |
temper=$(grep -oPm 1 '(?<=temp1:).*?(?=C)' <<< $(sensors)) | |
temperint=$(sed 's/[^0-9]//g' <<< $(echo $temper | cut -d " " -f1)) | |
echo $(echo $temper | cut -d " " -f1) | |
if (( $temperint > 900 )); then | |
notify-send OVERHEAT: $(echo $temper | cut -d " " -f1) | |
fi | |
#disengage fan when necesary | |
if (( $temperint > 950 )); then | |
echo level disengaged | sudo tee /proc/acpi/ibm/fan | |
elif (( $temperint < 900 )); then | |
echo level auto | sudo tee /proc/acpi/ibm/fan | |
fi | |
sleep 4 | |
if (( $temperint < 800 )); then | |
sleep 4 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment