You may want to confirm that a device is actually connected to an Etherenet interface before attempting to run a script. Program int6kwait can be used for this purpose. We often print a brief message to alert the operator that there is no connection or the device has no power applied.
int6kwait -xqsi ${NIC1} if [ ${?} != 0 ]; then echo "Device is not connected" exit 1 fi
In the above example, we invoke int6kwait to poll the device connected to a specific Ethernet interface (-i
) until the firmware starts (-s
). The program will return a non-zero return value (-x
) if the device does not start within a given period of time. By default, the timeout period is 60 seconds. On return, we check the return code then print an error message and exit the script on timeout. Symbol NIC1 must be defined earlier in the script, possibly in hardware.sh.