Created
August 22, 2014 10:50
-
-
Save dcreager/16223c48d9801656d132 to your computer and use it in GitHub Desktop.
Wait for an interface to have an IP address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
INTERFACE=$1 | |
if [ -z $INTERFACE ]; then | |
echo "Usage: wait-for-interface [interface name]" | |
exit 1 | |
fi | |
echo "Wait for $INTERFACE to have an IP address..." | |
while ! ip addr show $INTERFACE | grep inet >/dev/null; do | |
# Wait a small amount of time before checking again | |
sleep 0.1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment