Skip to content

Instantly share code, notes, and snippets.

@codezixo
Created August 20, 2017 07:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save codezixo/6371e66dcfd6d5a75672489457b91adf to your computer and use it in GitHub Desktop.
#!/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