Created
October 24, 2016 12:44
-
-
Save skygunner/cc0695ec3b724a90dec84c3803e0541f to your computer and use it in GitHub Desktop.
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/bash | |
# | |
# Usage: lstemp [ -w or -W] | |
# -w / -W: Wake up a sleeping drive to take it's temperature | |
# | |
adastat () { echo -n `camcontrol cmd $1 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r - | awk '{print $10 " " ; }'` " " ; } | |
echo | |
echo System Temperatures - `date` | |
cat /etc/version.freenas | |
uptime | awk '{ print "\nSystem Load:",$(NF-2),$(NF-1),$(NF),"\n" }' | |
echo "CPU Temperature:" | |
sysctl -a | egrep -E "cpu\.[0-9]+\.temp" | |
echo | |
echo "Drive Activity Status" | |
for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do echo -n $i:; adastat $i; done; echo ; echo | |
smartopt=`echo $@ | awk '{opt="-n standby"; if(match(tolower($0),'/-w/')) opt=""; print opt; }'` | |
echo "HDD Temperature:" | |
for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }') | |
do | |
echo $i `smartctl -a $smartopt /dev/$i | awk 'BEGIN { DevName="N/A - Drive in standby mode" } /Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'` | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment