Changeset 84c2881 in lab.git for iproute/setroute.sh


Ignore:
Timestamp:
Jun 30, 2009 10:50:47 PM (15 years ago)
Author:
mitty <mitty@…>
Branches:
master, trunk
Children:
4a36a1b
Parents:
8c804d8
Message:
  • 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • iproute/setroute.sh

    r8c804d8 r84c2881  
    2929# get IP address, network mask, default gateway info 
    3030IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | cut -d / -f 1` 
     31if [ -z ${IPADDR} ]; then 
     32    # fail to bind IP address to device 
     33    echo "${IFACE} has no IP address." 
     34    exit 
     35fi 
    3136NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | cut -d ' ' -f 1` 
    3237 
Note: See TracChangeset for help on using the changeset viewer.