Last active
July 25, 2025 03:50
-
-
Save mypapit/01770a1fa47826db1f50caf45f6a9035 to your computer and use it in GitHub Desktop.
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 | |
| # semi-automatic script to check nvidia gpu temperature, and then trigger the fan for 15 minutes. | |
| # intended to run within other scripts or in crontab | |
| # Query GPU temperature | |
| export DISPLAY=:0 | |
| TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits) | |
| echo "$TEMP" | |
| # Check if TEMP is greater than 60 | |
| if [ "$TEMP" -gt 60 ]; then | |
| # Set fan control to manual and fan speed to 30% | |
| nvidia-settings -a GPUFanControlState=1 -a GPUTargetFanSpeed=30 | |
| # Wait for 15 minutes (900 seconds) | |
| sleep 900 | |
| # Restore fan control to automatic | |
| nvidia-settings -a GPUFanControlState=0 | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment