This is sample app for http://apple.stackexchange.com/q/139267/74657 question.
To make it work:
- place:
.networkConnectedinside$HOMEdirectory - place:
.networkDisconnectedinside$HOMEdirectory - place:
Network-Listener.plistinside$HOME/Library/LaunchAgents/directory - place:
Network Listener.appinside/Applicationsdirectory - make
.networkConnectedand.networkDisconnectedexecutable
Executable scripts:
- File
.networkDisconnectedgets the name of the disconnected network as first argument. - File
.networkConnectedgets the name of the connected network as second argument. - File
.networkConnectedgets the name of disconnected network as first argument.
NOTE: right now first argument to .networkConnected is always „NOT_CONNECTED” because between changing the network - notification about disconnection is sent to this daemon.
Credits: Network change notifications code from http://stackoverflow.com/a/15102521/3488699