Created
February 16, 2025 16:01
-
-
Save wodor/d2a87b64445c1d07527061ebd725dec3 to your computer and use it in GitHub Desktop.
Control fan from nvidia-smi
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 | |
| TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2) | |
| DEVICE=/sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1 | |
| echo 1 > /sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1_enable | |
| while true; do | |
| TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2) | |
| echo "Current temperature: $TEMP" | |
| if (( TEMP > 70 )); then | |
| # echo "Temperature is above 75, writing 256 to /tmp/test" | |
| echo 256 > $DEVICE | |
| elif (( TEMP > 50 )); then | |
| # echo "Temperature is above 50, writing 150 to /tmp/test" | |
| echo 160 > $DEVICE | |
| elif (( TEMP > 40 )); then | |
| # echo "Temperature is above 40, writing 130 " | |
| echo 130 > $DEVICE | |
| else | |
| # echo "Temperature is below 40, writing 0" | |
| echo 0 > $DEVICE | |
| fi | |
| sleep 1 | |
| done |
Author
wodor
commented
Feb 16, 2025
Author
$ cat /etc/modules-load.d/modules.conf
coretemp
lm75
nct6775
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment