From 622342d73bf54d4312022d74949dea01a36d17f2 Mon Sep 17 00:00:00 2001 From: Nils <32552517+byReqz@users.noreply.github.com> Date: Mon, 8 Feb 2021 15:13:48 +0000 Subject: [PATCH] accounted for random numbers on lsi --- stocheck.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stocheck.sh b/stocheck.sh index 721a64b..49a43af 100644 --- a/stocheck.sh +++ b/stocheck.sh @@ -155,9 +155,11 @@ while [ -z "$1" ]; do echo "-------------------------------------------" megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state" echo "-------------------------------------------" - for x in {0..32};do - scan=$(megacli -pdlist -a0 | grep "Device Id") - if [[ -n $(echo $scan | grep $x) ]];then + scan=$(megacli -pdlist -a0 | grep "Device Id") + p1=$(head -n 1 $scan | cut -c 12-) + pz=$(tail -n 1 $scan | cut -c 12-) + for x in {$p1..$pz};do + if [[ -n $(echo $scan | grep -E "$x") ]];then echo "------------------- p$x --------------------" smartctl -i -d sat+megaraid,$x /dev/sda | grep -e "=== START OF INFORMATION SECTION ===" -e "Device Model:" -e "Serial Number:" -e "Firmware Version:" -e "User Capacity:" -e "SMART support is:" -e "Sector Size:" -e "Rotation Rate:" echo ""