Files
MOTD/30-hdd-temp.save
2019-03-28 13:35:54 +03:00

20 lines
419 B
Bash

#!/bin/bash
sd=(sda sdb sdc sdd)
out=""
clear="\e[0m"
my_target_temp=45
for i in ${!sd[@]}; do
temp=$(hddtemp -nq /dev/${sd[$i]} 2> /dev/null)
color="\e[42m"
if [ "$temp" -ge "${my_target_temp}" ]; then
color="\e[41m"
fi
mapfile -t out <"${sd[$i]} \e[30m $color $temp°$clear \e[39m ,"
c=i+1
done
out+="\n"
echo -e "
HDD Temps:"
printf "$out" | column -c $c -ts $',' | sed -e 's/^/ /'