Created
May 12, 2024 14:25
-
-
Save libcrack/91470a86827272d09cfe7d279f9259c5 to your computer and use it in GitHub Desktop.
Script to read CPU temperature in FreeBSD/pfSense boxes
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/sh | |
# [email protected] | |
# Mon Sep 9 21:30:51 CEST 2019 | |
# | |
# Title : cputemp | |
# Description: Prints the average CPU core temperature | |
# Author : linuxitux | |
# Date : 12-01-2016 | |
# Usage : ./cputemp | |
# Notes : kldload coretemp | |
TEMP=0 | |
CPUS=0 | |
for T in $(sysctl -a | grep temperature | cut -d':' -f2 | tr -d " " | tr -d C | tr -d .) | |
do | |
TEMP=$((TEMP + T)) | |
CPUS=$((CPUS + 1)) | |
done | |
TEMP=$((TEMP / CPUS / 10)) | |
if [ "${1}X" != "X" ]; then | |
echo "CPUs: ${CPUS}" | |
echo "Temp: ${TEMP} C" | |
else | |
echo "${TEMP}" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment