Шалом.
Ежели у вас FreeBSD, проверьте, пожалуйста, скрипт. Если работать не будет, скиньте, пожалуйста, sysctl hw.acpi.thermal в комментариях. Заранее благодарю.
#!/bin/sh
cpu_temp_delay="5"
cpu_temp_sysctl_cmd="sysctl -n"
cpu_temp_thermal_dev="tz0"
cpu_temp_value_dec="20"
cpu_temp_char="▊"
cpu_temp_mib_current="${cpu_temp_sysctl_cmd} \
hw.acpi.thermal.${cpu_temp_thermal_dev}.temperature | cut -d, -f1"
cpu_temp_mib_max="${cpu_temp_sysctl_cmd} \
hw.acpi.thermal.${cpu_temp_thermal_dev}._CRT | cut -d, -f1"
cpu_temp_value_max="$(eval ${cpu_temp_mib_max})"
cpu_temp_level1="$((${cpu_temp_value_max}/2))"
cpu_temp_level2="$((${cpu_temp_value_max}/4+${cpu_temp_level1}))"
color_red="\033[1;31m"
color_green="\033[1;32m"
color_yellow="\033[1;33m"
color_off="\033[m"
while : ; do
cpu_temp_value_current="$(eval ${cpu_temp_mib_current})"
cpu_temp_value_count="$((0 + ${cpu_temp_value_dec}))"
printf "${cpu_temp_value_current}°C "
until [ "$cpu_temp_value_count" -eq "$cpu_temp_value_current" ] ; do
cpu_temp_value_count="$(($cpu_temp_value_count + 1))"
if [ "$cpu_temp_value_count" -le "${cpu_temp_level1}" ] ; then
printf "${color_green}${cpu_temp_char}${color_off}"
elif [ "$cpu_temp_value_count" -ge "$((${cpu_temp_level1} + 1))" \
-a "$cpu_temp_value_count" -le "${cpu_temp_level2}" ] ; then
printf "${color_yellow}${cpu_temp_char}${color_off}"
elif [ "$cpu_temp_value_count" -ge "$((${cpu_temp_level1} + 1))" ] ; then
printf "${color_red}${cpu_temp_char}${color_off}"
fi
done
printf "\n"
sleep ${cpu_temp_delay}
done