added "install it" target
[gnt-info] / smart-megaraid.sh
index 35db0c9..88f7d44 100755 (executable)
@@ -28,7 +28,11 @@ lsblk --noheadings --scsi -o name | while read drive ; do
        smartctl -a /dev/$drive > /dev/shm/smart.$drive
        if egrep -q '(PERC|MegaRaid|DELL)' /dev/shm/smart.$drive ; then
                megaraid $drive
+               rm /dev/shm/smart.$drive
        fi
 done
 
+grep 'Serial Number' /dev/shm/smart.sd* | cut -d: -f3| sort | uniq -c | grep -v ' 1 ' | awk '{ print $2 }' > /dev/shm/smart.duplicate && \
+       grep -l -f /dev/shm/smart.duplicate /dev/shm/smart.sd? | xargs -i rm -v {}
+
 egrep -i "$pattern" /dev/shm/smart.* | grep -v -- '-  *0$' | cut -d. -f2- | sed -e 's/:/\t/'