标签:bash user The linux not found and res idg bin
by Mike Andrews
# lsscsi -t [2:0:0:0] disk iqn.2009-12.com.blockbridge:t-pjxfzufjkp-illoghjk,t,0x1 /dev/sda [3:0:0:0] disk iqn.2009-12.com.blockbridge:t-pjxfzuecga-eajejghg,t,0x1 /dev/sdb [4:0:0:0] disk iqn.2009-12.com.blockbridge:t-pjxfzufjjo-pokqaja,t,0x1 /dev/sdd [5:0:0:0] disk iqn.2009-12.com.blockbridge:t-pjxfzufnfg-cqikkgl,t,0x1 /dev/sdc
# iscsiadm -m node -T iqn.2009-12.com.blockbridge:t-pjxfzufjkp-illoghjk | egrep ‘node.conn.+address‘ node.conn[0].address = 172.16.5.148
#!/usr/bin/bash if [[ -z $1 ]]; then >&2 echo "Usage: devip.sh <device>" exit 1 fi iqn=$(sudo lsscsi -t | grep "$1" | grep iqn | awk ‘{print $3}‘ | awk -F , ‘{print $1}‘) if [[ -z "$iqn" ]]; then >&2 echo "IQN not found for \"$1\"." exit 1 fi sudo iscsiadm -m node -T $iqn | egrep ‘node.conn.+address‘ | awk -F ‘ *= *‘ ‘{print $2}‘ exit $?
Linux 如何通过 iscsi target name 获取 ip
标签:bash user The linux not found and res idg bin
原文地址:https://www.cnblogs.com/liujx2019/p/11251605.html