Trigger to execute a command when GPU temperature reaches a certain point

Joined
Apr 4, 2023
Messages
1
Reaction score
0
something to play a sound/execute a command/start or stop a program when gpu temperature sensor reads 70 degrees celcius and stop it when it reads <70
 
Joined
Mar 31, 2023
Messages
95
Reaction score
8
You can use a shell script to monitor the GPU temperature and perform the desired action based on the temperature reading. Here is an example script that plays a sound when the GPU temperature reaches 70 degrees Celsius and stops the program when the temperature goes below 70 degrees Celsius:
Bash:
#!/bin/bash

# Set the temperature threshold
TEMP_THRESHOLD=70

# Loop indefinitely
while true; do
  # Get the current GPU temperature
  TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)

  # Check if the temperature is above the threshold
  if [[ $TEMP -ge $TEMP_THRESHOLD ]]; then
    # Play a sound
    paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga

    # Execute a command or start a program
    # For example, start a stress test using the FurMark benchmark
    /path/to/FurMark-1.24.0.0/FurMark.exe /run /nogui /max_gpu_temp 80 /no_score_box

  else
    # Stop the program
    # For example, stop the FurMark benchmark
    killall FurMark.exe
  fi

  # Sleep for 1 minute before checking the temperature again
  sleep 60
done
In this script, we first set the temperature threshold to 70 degrees Celsius. We then enter an infinite loop that continuously checks the current GPU temperature using the nvidia-smi command.

If the temperature is above the threshold, the script plays a sound using the paplay command and executes a command or starts a program (in this example, we start the FurMark benchmark with a maximum GPU temperature of 80 degrees Celsius).

If the temperature is below the threshold, the script stops the program (in this example, we stop the FurMark benchmark using the killall command).

The script sleeps for 1 minute before checking the temperature again to avoid excessive CPU usage. You can modify the script to perform different actions or use different programs based on your requirements.
 
Joined
Nov 23, 2023
Messages
56
Reaction score
3
something to play a sound/execute a command/start or stop a program when gpu temperature sensor reads 70 degrees celcius and stop it when it reads <70
Tools like HWMonitor, Open Hardware Monitor, or GPU-Z provide real-time monitoring of GPU temperature. These often have built-in alerting features that can play sounds, send notifications, or execute scripts when temperatures reach specific thresholds.
 
Joined
Nov 23, 2023
Messages
56
Reaction score
3
something to play a sound/execute a command/start or stop a program when gpu temperature sensor reads 70 degrees celcius and stop it when it reads <70
  • lm-sensors (Linux only) - Free command-line tool with scripting options.
  • macfancontrol (Mac only) - Free tool with scripting through tools like AppleScript.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top