projects
/
gnt-info
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
install windows 10 using ide disk and virtio.iso drivers
[gnt-info]
/
smart-megaraid.sh
diff --git
a/smart-megaraid.sh
b/smart-megaraid.sh
index
76d7ed0
..
88f7d44
100755
(executable)
--- a/
smart-megaraid.sh
+++ b/
smart-megaraid.sh
@@
-4,7
+4,7
@@
# smart-megaraid.sh '^# 1' # default without args
# SMART="-t long" smart-megaraid.sh # execute smart command
# smart-megaraid.sh '^# 1' # default without args
# SMART="-t long" smart-megaraid.sh # execute smart command
-pattern='(^# [1-2]|test remaining|Hours|Error|Serial|Model|Firmware|Load|Reallocated|Pending)'
+pattern='(^# [1-2]|test remaining|Hours|Error|Serial|Model|Firmware|Load|Reallocated|Pending
|failure
)'
test ! -z "$1" && pattern=$*
did_megaraid=0
test ! -z "$1" && pattern=$*
did_megaraid=0
@@
-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
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
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/'
egrep -i "$pattern" /dev/shm/smart.* | grep -v -- '- *0$' | cut -d. -f2- | sed -e 's/:/\t/'