Skip to content

Instantly share code, notes, and snippets.

@twentythousandphantoms
Created October 9, 2018 20:15
Show Gist options
  • Save twentythousandphantoms/43dd3fc92d3426f24d805e9bc0f7f292 to your computer and use it in GitHub Desktop.
Save twentythousandphantoms/43dd3fc92d3426f24d805e9bc0f7f292 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -d "/sys/class/fc_host" ] ; then
cd /sys/class/fc_host
ls -w1 | while read i ; do
if [ -f "$i/port_name" ] ; then
echo -n "wwn: "
cat $i/port_name
fi
done
elif [ -d "/proc/scsi/qla2xxx" ] ; then
cd /proc/scsi/qla2xxx
ls -w1 | while read i ; do
if [ -f "$i" ] ; then
echo -n "wwn: "
grep -E "scsi-qla.-adapter-port" $i|cut -d= -f2|cut -d\; -f1
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment