{"id":116,"date":"2013-03-12T00:25:07","date_gmt":"2013-03-12T00:25:07","guid":{"rendered":"http:\/\/devopsny.com\/blog\/?p=116"},"modified":"2013-09-11T10:56:25","modified_gmt":"2013-09-11T14:56:25","slug":"shell-script-to-list-current-website-ip","status":"publish","type":"post","link":"https:\/\/devopsny.com\/blog\/2013\/03\/12\/shell-script-to-list-current-website-ip\/","title":{"rendered":"Shell script to list current website IP"},"content":{"rendered":"<p>If your sites are in multiple geographical locations, this script will show where a site currently is being served from. It colors the output based on location.<\/p>\n<p>#!\/bin\/bash<br \/>\n# where_are_you.sh<br \/>\n#do a dig against the company name servers and spit out the current IP of the sites.<\/p>\n<p>array=(\u00a0<a href=\"http:\/\/www.puritan.com\/\">www.site.com<\/a> <a href=\"http:\/\/www.site2.com\/\">www.site2.com<\/a> <a href=\"http:\/\/www.site3.com\/\">www.site3.com<\/a> <a href=\"http:\/\/www.site99.com\/\">www.site99.com<\/a>\u00a0)<\/p>\n<p>for i in &#8220;${array[@]}&#8221;<br \/>\ndo<br \/>\ndig @ns.server.company $i a | grep -v &#8216;;&#8217; |grep $i | awk &#8216;{ if ( substr($5, 1, 8) == &#8220;x.x.x&#8221; ) printf &#8220;%-30s %s\\n&#8221;, &#8220;\\033[1;32;40m&#8221;$5,$1; else printf &#8220;%-30s %s\\n&#8221;, &#8220;\\033[1;34;40m&#8221;$5,$1 }&#8217;<\/p>\n<p>done | sort -n<br \/>\ntput sgr0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your sites are in multiple geographical locations, this script will show where a site currently is being served from. It colors the output based on location. #!\/bin\/bash # where_are_you.sh #do a dig against the company name servers and spit out the current IP of the sites. array=(\u00a0www.site.com www.site2.com www.site3.com www.site99.com\u00a0) for i in &#8220;${array[@]}&#8221; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[39,64,78,77],"tags":[42,65,214,79],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-bash","category-devops","category-dig","category-dns","tag-bash-2","tag-devops-2","tag-dig","tag-dns-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3fcrv-1S","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":2,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":322,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/116\/revisions\/322"}],"wp:attachment":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}