Created
October 8, 2018 12:04
-
-
Save foxutech/53912112a703f0e4f505f00fd1abbe5c to your computer and use it in GitHub Desktop.
dns lookup script with loop.. https://foxutech.com
This file contains hidden or 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/bash | |
hostname=foxu.tech | |
sleep_time=2 | |
count=0 | |
success_count=0 | |
max_count=$((1*6)) | |
while [ $count -lt $max_count ]; | |
do | |
echo -n "$count/$max_count: " | |
date | |
nslookup $hostname | |
status=$? | |
if [ "$status" == "0" ]; then | |
success_count=$(($success_count + 1)) | |
if [ $success_count -gt 1 ]; then | |
break | |
fi | |
fi | |
count=$(($count + 1)) | |
echo "Sleeping $sleep_time" | |
sleep $sleep_time | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment