Created
January 11, 2016 16:41
-
-
Save sigxcpu76/b4cb66c2fd0cbf6ec227 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
#!/usr/bin/bash | |
if [ "s$1" != "s-H" ]; then | |
printf "%-22s %-22s %-22s %5s %5s C\n" DISK MODEL SERIAL SIZE TEMP | |
fi | |
for i in $(/usr/bin/ls /dev/rdsk | /usr/bin/awk "/s2$/ {print}" | /usr/bin/sed "s/s2//"); do | |
disk=/dev/rdsk/${i}p0 | |
temp=$(smartctl -d sat,12 -l scttempsts $disk | grep Current | awk '{print $3}') | |
#model=$(smartctl -d sat,12 -i $disk | grep "Device Model" | awk '{print $3}') | |
model=$(smartctl -d sat,12 -i $disk | grep "Device Model" | cut -f2 --delimiter=":" | sed -e 's/^[[:space:]]*//' | tr -dc '[:print:]') | |
serial=$(smartctl -d sat,12 -i $disk | grep "Serial Number" | cut -f2 --delimiter=":" | sed -e 's/^[[:space:]]*//' | tr -dc '[:print:]') | |
size=$(sysinfo -p | grep $i | cut -f2 --delimiter="==") | |
if [ -z $temp ]; then | |
temp="0" | |
fi | |
printf "%-22s %-22s %-22s %5s %5s C\n" $i "$model" "$serial" $size $temp | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment