Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Moving from home to work: how is domainname updated?

Moving from home to work: how is domainname updated?
Thread Tools
Since EBCDIC
Grizzled Veteran
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Jun 13, 2008, 02:57 PM
 
I have things in my .tcshrc that are run depending upon location context. At home I have some resources, at work I have others. I was using `hostname | cut -f 2- -d.` (because Darwin's domainname gives me a blank string) but recently I'm getting "mickey.local" whether I'm using my home or office networks (via DHCP).

A friend suggests I work through ifconfig, maybe pulling its inet or broadcast values, but that seems ugly.

What's the correct way to update network status when I switch Networks in the pref pane?

Conversely, is there a way to detect an Ethernet cable being inserted and cause Networks to switch automagically?
Since EBCDIC
Using Macs since they were Lisas.
     
Since EBCDIC  (op)
Grizzled Veteran
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Jun 13, 2008, 02:58 PM
 
Update: /etc/resolve.conf seems to be updated with a proper value...

For others searching, my .tcshrc (or .cshrc, if you're a csh user), now says:

case "Darwin":
set myHost = `hostname | cut -f1 -d.`
set myDomain = `cat /etc/resolv.conf | grep domain | cut -f2 -d' '`
breaksw
If this *isn't* the proper way to detect the current network state, or if there's some way to trigger a shell script to go when a network is changed, please share! Thanks.
( Last edited by Since EBCDIC; Jun 13, 2008 at 03:09 PM. )
Since EBCDIC
Using Macs since they were Lisas.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:15 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,