Skip to content

Instantly share code, notes, and snippets.

@qxzg
Forked from lambdacpp/gist:6396956
Last active June 23, 2020 10:50
Show Gist options
  • Select an option

  • Save qxzg/04a119b55109c3e2b18f20d4fa00292a to your computer and use it in GitHub Desktop.

Select an option

Save qxzg/04a119b55109c3e2b18f20d4fa00292a to your computer and use it in GitHub Desktop.
#! /bin/sh
while true
do
echo " CPU temp :"
sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
echo
echo " HDD temp :"
for i in $(sysctl -n kern.disks)
do
DevTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'`
DevSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'`
DevName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'`
echo $i $DevTemp $DevSerNum $DevName
done
echo 5
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment