Commit 8514fbc4 authored by Dan Reading's avatar Dan Reading
Browse files

checkpoint: TYPE and Temp working

parent c3f49db0
......@@ -111,9 +111,9 @@ main() {
$name_val ) d[$name_val]="${drive[$idx]}" ;;
$sectors_val ) d[$sectors_val]=$(getsectors ${drive[$idx]}) ;;
$bpers_val ) d[$bpers_val]=$(getbpers ${drive[$idx]}) ;;
# $driver_val ) d[$driver_val]=$(getdriver ${drive[$idx]}) ;;
# $type_val ) d[$type_val]=$(gettype ${drive[$idx]}) ;;
# $temp_val ) d[$temp_val]=$(gettemp ${drive[$idx]}) ;;
$driver_val ) d[$driver_val]=$(getdriver ${drive[$idx]}) ;;
$type_val ) d[$type_val]=$(gettype ${drive[$idx]}) ;;
$temp_val ) d[$temp_val]=$(gettemp ${drive[$idx]}) ;;
# $model_val ) d[$model_val]=$(getmodel ${drive[$idx]}) ;;
# $serial_val ) d[$serial_val]=$(getserial ${drive[$idx]}) ;;
# $wspeed_val ) d[$wspeed_val]=$(getwspeed ${drive[$idx]}) ;;
......@@ -389,25 +389,54 @@ echo -n "${scan[@]}"
}
getdriver() {
echo '"UNKNOWN"'
return 0
# don't support this right now
# smtcl=$(findSmartctl)
# if [ "${smtcl/smartcl}" == "$smtcl" ] ; then
# echo '"UNKNOWN"'
# return 0
# fi
echo '"NA"'
return 0
}
gettype() {
set -x
smtcl=$(findSmartctl)
if [ "${smtcl/smartcl}" == "$smtcl" ] ; then
echo '"UNKNOWN"'
if [ "${smtcl/smartctl}" == "$smtcl" ] ; then
echo '"NA"'
return 0
fi
data=$($smtcl $1 | grep "")
res=1
set +x
return 0
echo $FUNCNAME
res=$($smtcl -i $1 | grep "ATA Version is")
if [ -n "$res" ] ; then
res=${res##*is: }
res=${res// /} #get rid of spaces
[[ $res > 6 ]] && res='"SATA"' || res='"PATA"'
echo $res
return 0
fi
res=$($smtcl -i $1 | grep "SAS")
if [ -n "$res" ] ; then
echo '"SAS"'
return 0
fi
res=$($smtcl -i $1 | grep "SCSI")
if [ -n "$res" ] ; then
echo '"SCSI"'
return 0
fi
echo '"UNKNOWN"'
return 0
}
gettemp() {
echo $FUNCNAME
smtcl=$(findSmartctl)
if [ "${smtcl/smartctl}" == "$smtcl" ] ; then
echo '"NA"'
return 0
fi
res="$($smtcl -l scttempsts $1 | grep -i "Current Temperature:" | awk '{print $3}')"
if [ -z $res ] ; then
#type 2
res="$($smtcl -a $1 | grep -i "Current Drive Temperature:" | awk '{print $4}')"
fi
[[ $res ]] && echo $res || echo '"UNKNOWN"'
return 0
}
getmodel() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment