UnderpantsGnome edited this page Sep 13, 2010 · 9 revisions

What is this?

location_watcher is a launchd controlled network location watcher

What does it do?

It watches your network settings and if they change it looks to see if there is a script that should be run for this particular location.

I’m using it because in the office I have servers that are accessible both internally and externally, but since they are on different IPs based on inside and outside and they are using virtual hosts it was a hassle. So instead of having to use different host names based on where I was, which I was doing initially, I can have this update my hosts file or anything else I want on a network change.

How do I use it?

You can clone the repository


git clone git://github.com/UnderpantsGnome/location_watcher.git

or you can download the zip from here and click the download button.

When you have the files, run ./install from the directory and you are all set.

How do I configure it?

The following configuration would run the script in LOCATIONS for the matching SSID, EN0IP or EN1IP when the network changes.

So if you are on the WorkSSID wireless network it will execute ~/bin/location_watcher/office and so on. It trys to find the network in the following order SSID, EN0IP, EN1IP.


LOCATIONS=(office home george)
SSIDS=(WorkSSID homeSSID georgeSSID)
EN0IPS=(192.168. 10.0.0. )
EN1IPS=(192.168. 10.0.0. )

You can also silence the notifications with


USE_NOTIFICATIONS="false"

By default it will use growlnotify to tell you what it is doing, it will fall back to using Finder alerts if it can’t find growlnotify. Trust me, you are either going to want to install growlnotify or turn off notifications, the Finder alerts are annoying.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.