[download]

local/bin/systemp

   1 #!/bin/bash
   2 #         ░███████
   3 #       ░███████       D O T F I L E S
   4 #       ░███████       S Y S T E M P
   5 #    ░█████████████
   6 #       ░███████
   7 #       ░███████       LGPL <http://www.gnu.org/licenses/>
   8 #       ░██  ░██
   9 #       ░██  ░██   (C) 2020 Alexey Gagin <http://www.lexa.by/dotfiles/>
  10 
  11 printf '%d°C CPU\n' $(sensors | awk '/CPUT/ { print int($2) }')
  12 printf '%d°C GPU\n' $(nvidia-settings -tq gpucoretemp | sed 1q)
  13 
  14 join <(lsblk -pdo name,rota | sed -E '1d; s/(\s+|$)/: /g') <(hddtemp -q /dev/sd? 2>&1) |
  15 awk -F ':\\s+' 'int($4) { printf "%2d°C %s %s\n", $4, ($2 ? "HDD" : "SSD"), $3 }'
  16 
  17 # printf '%d°C CPU %s\n' \
  18 # $(sensors | awk '/CPUT/ { print int($2) }') \
  19 # $(awk '/model name/ { print $6; exit }' /proc/cpuinfo)
  20 
  21 # nvidia-smi -q | awk -F '\\s+:\\s+' '
  22 #     /Product Name/     { n=$2 }
  23 #     /GPU Current Temp/ { c=$2 }
  24 #     END { print int(c) "°C GPU", n }
  25 # '
  26 
  27 # nvidia-smi --query-gpu=temperature.gpu,name \
  28 # --format=csv,noheader | sed 's/,/°C GPU/'
  29 
  30 # hddtemp -q /dev/sd? 2>&1 | awk -F ': ' '{ print $1, int($3), $2 }' |
  31 # cut -b 6- | while read dev temp name; do
  32 #     [[ $1 == -a ]] || (( temp > 0 )) || continue
  33 #     type=(SSD HDD) type=${type[$(< /sys/block/$dev/queue/rotational)]}
  34 #     printf '%2d°C %s %s\n' $temp $type "$name"
  35 # done