diff --git a/scripts/wrapper-badblocks b/scripts/wrapper-badblocks index aafc382..a05b4e5 100755 --- a/scripts/wrapper-badblocks +++ b/scripts/wrapper-badblocks @@ -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