Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/bash
dns_server="@IP DNS SERVER 1@"
while [ -n "$dns_server" ]; do
ping -q -c 1 $dns_server | while read pong; do echo "$(TZ='Europe/Moscow' date): $pong" » ./ck_dns_test.out; done
host -t A @DNS MANE OF YOUR HOST@ $dns_server | while read myhost; do echo "$(TZ='Europe/Moscow' date): $myhost" » ./ck_dns_test.out; echo $myhost; done
echo '' » ./ck_dns_test.out
case "$dns_server" in
@IP DNS SERVER 1@)
dns_server="@IP DNS SERVER 2@"
;;
@IP DNS SERVER 2@)
sleep 60
echo "$(TZ='Europe/Moscow' date)"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment