Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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
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.