From a5e247b20cdcaf6aaecde02d39f9ddafa8445d43 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Fri, 23 Dec 2016 13:22:20 -0600 Subject: [PATCH] Bugfix: regresion: SMART attributes after badblocks killed clears ERROR --- scripts/wrapper-badblocks | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) 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