mirror of
https://github.com/Spearfoot/FreeNAS-scripts
synced 2025-12-11 13:53:19 +00:00
Changed method of parsing CPU temperature
Use awk to parse the CPU temperature: former method sliced off part of the temperature on systems with 10 or more CPUs.
This commit is contained in:
@@ -45,7 +45,8 @@ cores=$(sysctl -a | grep "hw.ncpu" | awk '{print $2}')
|
|||||||
printf "=== CPU (%s) ===\n" "${cores}"
|
printf "=== CPU (%s) ===\n" "${cores}"
|
||||||
cores=$((cores - 1))
|
cores=$((cores - 1))
|
||||||
for core in $(seq 0 $cores); do
|
for core in $(seq 0 $cores); do
|
||||||
temp="$(sysctl -a | grep "cpu.${core}.temp" | cut -c24-25 | tr -d "\n")"
|
# temp="$(sysctl -a | grep "cpu.${core}.temp" | cut -c24-25 | tr -d "\n")"
|
||||||
|
temp=$(sysctl -a | grep "cpu.${core}.temperature" | awk '{print $2}')
|
||||||
if [ "$temp" -lt 0 ]; then
|
if [ "$temp" -lt 0 ]; then
|
||||||
temp="--n/a--"
|
temp="--n/a--"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user