-
-
Save hwpplayer1/4fa5a1e54fe4bf34c9b416671ba8ed1a to your computer and use it in GitHub Desktop.
gnu/linux bash: temp of cpu/gpu/hdd
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 | |
CPU_NAME=`awk -F: '/model name/ { gsub(/^ */, "", $2); print $2 }' /proc/cpuinfo | head -1` | |
CPU_01=`sensors | grep -E "Tctl:\s+\+[0-9]+\.[0-9]+" | awk '{print $2}' | grep -oP '[0-9]+\.[0-9]+'` | |
CPU_02=`sensors | grep -E "Tccd1:\s+\+[0-9]+\.[0-9]+" | awk '{print $2}' | grep -oP '[0-9]+\.[0-9]+'` | |
GPU_NAME=`/usr/bin/nvidia-smi | grep -E 'NVIDIA\s' | awk '{print $3, $4, $5, $6}'` | |
GPU_01=`/usr/bin/nvidia-smi | grep -E '[0-9]+C' | awk '{print $3}' | grep -oP '[0-9]+'` | |
HDD01_01=`sensors | head -n 10 | tail -n 1 | grep -oP '\+[0-9]+\.[0-9]+' | head -n 1 | grep -oP '[0-9]+\.[0-9]+'` | |
HDD01_02=`sensors | head -n 11 | tail -n 1 | grep -oP '\+[0-9]+\.[0-9]+' | head -n 1 | grep -oP '[0-9]+\.[0-9]+'` | |
HDD02_01=`sensors | tail -n 3 | head -n 1 | grep -oP '\+[0-9]+\.[0-9]+' | head -n 1 | grep -oP '[0-9]+\.[0-9]+'` | |
echo -e "CPU:\t\t${CPU_NAME}" | |
echo -e "Sensor 01:\t${CPU_01}°C" | |
echo -e "Sensor 02:\t${CPU_02}°C" | |
echo "" | |
echo -e "GPU:\t\t${GPU_NAME}" | |
echo -e "Sensor:\t\t${GPU_01}°C" | |
echo "" | |
echo -e "HDD 01:" | |
echo -e "Sensor 01:\t${HDD01_01}°C" | |
echo -e "Sensor 02:\t${HDD01_02}°C" | |
echo "" | |
echo -e "HDD 02:" | |
echo -e "Sensor:\t\t${HDD02_01}°C" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment