57 lines
932 B
Text
57 lines
932 B
Text
|
#!/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
|
||
|
|
||
|
[[ -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
|