I've created sample daemon app for this purpose. You can find it on Github.
To make it run:
- Compile it using Xcode.
- Move
Network Listener.app
to /Applications
dir.
- Move
.networkConnected
and .networkDisconnected
to Your $HOME
dir.
- Move
Network-Listener.plist
to ~/Library/LaunchAgents
.
- Make
.networkConnected
and .networkDisconnected
executable.
It will automatically run when You log in to Your account. If You want to test it run this in Terminal:
launchctl load -S Aqua -w ~/Library/LaunchAgents/Network-Listener.plist
Scripts receive SSID name as arguments.
Feel free to change it for Your needs. In case of any problems let me know.
Everything was created to show the possibilities, a lot of things can be improved.