2025-06-22 21:18:32 +03:00

17 lines
384 B
Bash
Executable File

#!/bin/bash
if command -v nvidia-smi &> /dev/null; then
temp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | head -n1)
echo "$temp"
exit 0
fi
if command -v sensors &> /dev/null; then
temp=$(sensors | grep -iE 'edge|junction|temp1' | grep -Eo '[0-9]+(\.[0-9]+)?°C' | head -n1 | tr -d '°C')
echo "$temp"
exit 0
fi
echo "N/A"
exit 1