From c56b9782359f6c49933524d22be75b3def6a7fbb Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Fri, 1 Jun 2018 04:21:11 -0500 Subject: [PATCH] Reporte de badblocks --- scripts/report-basblocks | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/scripts/report-basblocks b/scripts/report-basblocks index 97b768d..fac3403 100755 --- a/scripts/report-basblocks +++ b/scripts/report-basblocks @@ -1,8 +1,56 @@ #!/bin/bash + +while getopts rq OPT 2>/dev/null ; do + case $OPT in + 'r') + REBUILD=1 + break + ;; + 'q') + QUIET=1 + break + ;; + esac +done + OUTPUT_DIR=/output/hwtests -for DIR in $OUTPUT_DIR/* ; do - [[ $DIR == snapshot ]] && next - echo $DIR +[[ -f scripts.env ]] && source scripts.env + +HEADER='SERVER|DISK|SERIAL|RESULT|COMMENT' + +for SRV_DIR in $OUTPUT_DIR/* ; do + SERVER=`basename $SRV_DIR` + [[ $SERVER == snapshot ]] && continue + SERVERS+=" $SERVER" + #echo $SRV_DIR done + +#echo $SERVERS + +if [[ -n $REBUILD ]] ; then + for SERVER in $SERVERS ; do + SRV_CSV=$OUTPUT_DIR/$SERVER/badblocks.csv + #echo $SRV_CSV + echo $HEADER > $SRV_CSV + DSK_DIR=$OUTPUT_DIR/$SERVER/disk + for CSV in $DSK_DIR/*.badblocks.csv ; do + if [[ -f $CSV ]] ; then + #echo $CSV + cat $CSV >> $SRV_CSV + fi + done + done + exit +fi + +if [[ -z $QUIET ]] ; then + echo $HEADER + for SERVER in $SERVERS ; do + SRV_CSV=$OUTPUT_DIR/$SERVER/badblocks.csv + if [[ -f $SRV_CSV ]] ; then + cat $SRV_CSV | grep -v 'SERVER' + fi + done +fi