Skip to content

Instantly share code, notes, and snippets.

@wilm0x42
Created June 20, 2018 18:15
Show Gist options
  • Save wilm0x42/a4d12fc57b81c8e97bc144eeb739cfec to your computer and use it in GitHub Desktop.
Save wilm0x42/a4d12fc57b81c8e97bc144eeb739cfec to your computer and use it in GitHub Desktop.
A script to prevent overheating on thinkpads
#!/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