Skip to content

Instantly share code, notes, and snippets.

@lambdacpp
Created August 31, 2013 08:40
Show Gist options
  • Select an option

  • Save lambdacpp/6396956 to your computer and use it in GitHub Desktop.

Select an option

Save lambdacpp/6396956 to your computer and use it in GitHub Desktop.
#! /bin/sh
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment