Last active
April 18, 2016 18:47
-
-
Save steigr/d58e03a3d0d3b0dfff5e824a3a85e503 to your computer and use it in GitHub Desktop.
Check if DNS Server is link local and wait up to 60s to become reachable
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 | |
link_local_dns() { | |
sed -e '/^[[:space:]]*nameserver/!d' \ | |
-e 's/^[[:space:]]*nameserver[[:space:]]*\(169\.254\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/' \ | |
/etc/resolv.conf | |
} | |
dns_reachable() { link_local_dns | xargs -n1 arping -q -f -c 60; } | |
[[ "$(link_local_dns)" ]] && dns_reachable |
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
RUN curl -sL https://gist.github.com/steigr/d58e03a3d0d3b0dfff5e824a3a85e503/raw/dns-resilience | install -m 0755 -o root -g root /dev/stdin /usr/bin/dns-resilience |
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
RUN wget -qO- https://gist.github.com/steigr/d58e03a3d0d3b0dfff5e824a3a85e503/raw/dns-resilience | install -m 0755 -o root -g root /dev/stdin /usr/bin/dns-resilience |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment