2007-08-31 15:11:42

View target WWIDS by fibre adapter with bash

#!/bin/bash
#################################################################
# Who: James Conner
# When: Aug 17, 2007
# What: wwids.sh
# Version: 0.0.1
# Why: View WWIDS by adapter
#################################################################
# Updates:
# Ver  -  Who  -  When  -  Why
# 0.0.1 - James Conner - Aug 17 - Initial creation
#################################################################
# To Do List:
#################################################################
ADAPTERS=`/bin/ls -1 /proc/scsi/qla2xxx`
WWIDS=( 50019DC 5001A90 5002A31 50087CD 500CA35 )

for a in ${ADAPTERS[@]}
do
echo "Adapter ${a}:"

for i in ${WWIDS[@]}
do
if [ "$i" = "50019DC" ]
  then
    echo "EVA1"
elif [ "$i" = "5001A90" ]
  then
    echo "EVA2"
elif [ "$i" = "5002A31" ]
  then
    echo "EVA3"
elif [ "$i" = "50087CD" ]
  then
    echo "EVA4"
elif [ "$i" = "500CA35" ]
  then
    echo "EVA5"
fi
cat /proc/scsi/qla2xxx/${a} | grep -i $i | grep -i "target"
done
echo ""
echo ""
done

Tags:   linux, bash     |    Perm Link:   View target WWIDS by fibre adapter with bash



James Conner