Posted By

sudarkoff on 08/28/06


Tagged

Bash network geektool internet status


Versions (?)

DNS lookup


 / Published in: Other
 

URL: http://projects.tynsoe.org/phpBB2/viewtopic.php?p=745

  1. And one to do a DNS lookup test on google:
  2. Code:
  3.  
  4. IFS=''
  5. DNSHOST='www.google.com'
  6. DIG=$( dig $DNSHOST )
  7. RC=$?
  8. if [ $RC -ne 0 ]; then
  9. echo "DNS lookup ($DNSHOST) failed"
  10. exit $RC
  11. fi
  12. RT=$( echo $DIG | grep "Query time" | cut -d' ' -f 4- )
  13. echo "DNS lookup ($DNSHOST) $RT"
  14. exit 0

Report this snippet  

You need to login to post a comment.