GamerChase Posted March 4, 2013 Posted March 4, 2013 Wondering if it's possible to build a workflow to display the current DNS settings, either as feedback into Alfred or a Notification Center output. I'm not looking to change the DNS (I can do that manually, if I have to). But I use Unblock-US.com to view region-specific content, and I want to be able to quickly check that the DNS settings haven't reverted back. Thoughts?
jdfwarrior Posted March 4, 2013 Posted March 4, 2013 Yes it could be done. A quick Google will show that you can read /etc/resolv.conf (using cat or whatever other method you want) and get the current DNS settings.
GamerChase Posted March 4, 2013 Author Posted March 4, 2013 So this is what I get out of Terminal, when I enter the "cat /etc/resolv.conf" command. # # Mac OS X Notice # # This file is not used by the host name and address resolution # or the DNS query routing mechanisms used by most processes on # this Mac OS X system. # # This file is automatically generated. # domain phub.net.cable.rogers.com nameserver 208.122.23.22 nameserver 208.122.23.23 What I have no idea how to do is to get Alfred to pull the "208.122.23.22" and "208.122.23.23" out and post them into Notification Center or back into Alfred.
jdfwarrior Posted March 5, 2013 Posted March 5, 2013 So this is what I get out of Terminal, when I enter the "cat /etc/resolv.conf" command. What I have no idea how to do is to get Alfred to pull the "208.122.23.22" and "208.122.23.23" out and post them into Notification Center or back into Alfred. servers=( `cat /etc/resolv.conf | grep nameserver | cut -d " " -f 2` ) echo "${servers[0]}" 8.8.8.8 echo "${servers[1]}" 8.8.4.4
GamerChase Posted March 5, 2013 Author Posted March 5, 2013 servers=( `cat /etc/resolv.conf | grep nameserver | cut -d " " -f 2` ) echo "${servers[0]}" 8.8.8.8 echo "${servers[1]}" 8.8.4.4 Dude, that's perfect. Thank you so much!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now