Bugfix: regresion: SMART attributes after badblocks killed clears ERROR

This commit is contained in:
Sandino Araico Sanchez 2016-12-23 13:22:20 -06:00
parent baecf3a314
commit a5e247b20c

View file

@ -109,24 +109,26 @@ if [[ -z $ERROR ]] ; then
#fi
sleep $SMARTLOG
done
# Check smart attributes after the badblocks test
ERROR=`smartctl -A -f brief /dev/$DISK \
| parse-smart-attr \
| grep ERROR \
| cut -d ':' -f 2
`
# TODO: Debug variable. Comment out for production
#ERROR=
if [[ -n $ERROR ]] ; then
RAW_ERROR=$ERROR
ERROR=''
for TOKEN in $RAW_ERROR ; do
ERROR="$ERROR $TOKEN"
done
smartctl -A -f brief /dev/$DISK \
| parse-smart-attr \
| sed "s/ERROR/$RES_ERROR/g" \
> $OUTPUT_DIR/disk/$SERIAL.smart.error
if [[ -z $ERROR ]] ; then
# Check smart attributes after the badblocks test
ERROR=`smartctl -A -f brief /dev/$DISK \
| parse-smart-attr \
| grep ERROR \
| cut -d ':' -f 2
`
# TODO: Debug variable. Comment out for production
#ERROR=
if [[ -n $ERROR ]] ; then
RAW_ERROR=$ERROR
ERROR=''
for TOKEN in $RAW_ERROR ; do
ERROR="$ERROR $TOKEN"
done
smartctl -A -f brief /dev/$DISK \
| parse-smart-attr \
| sed "s/ERROR/$RES_ERROR/g" \
> $OUTPUT_DIR/disk/$SERIAL.smart.error
fi
fi
#RET=$?
#echo $RET > $OUTPUT_DIR/disk/$SERIAL.badblocks.ret