From: mitty Date: Tue, 30 Jun 2009 13:50:47 +0000 (+0000) Subject: * abort if fail to bind IP address to NIC X-Git-Tag: r89-trunk~71 X-Git-Url: http://lab.mitty.jp/git/?a=commitdiff_plain;h=84c2881946d389e9ef241cfbf7434d7dca598196;p=lab.git * abort if fail to bind IP address to NIC * no DHCPd, disconnecting cables, etc... git-svn-id: https://lab.mitty.jp/svn/lab/trunk@7 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/iproute/setroute.sh b/iproute/setroute.sh index f493901..668fc59 100644 --- a/iproute/setroute.sh +++ b/iproute/setroute.sh @@ -28,6 +28,11 @@ fi # get IP address, network mask, default gateway info IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1` +if [ -z ${IPADDR} ]; then + # fail to bind IP address to device + echo "${IFACE} has no IP address." + exit +fi NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | cut -d ' ' -f 1` if [ -z "${GATEWAY}" ]; then