在 OSX 上 , 每次开机或者网络环境发生变化时,
- `/etc/resolv.conf`
- `/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist`
- `/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist`
这三个文件都会发生变化 , 写个 Agent 监控这几个文件 , 当发生改变时自动执行添加路由的脚本.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>
com.icymind.network</string>
<key>ProgramArguments</key>
<array>
<string>/Users/simon/Dropbox/Script/
com.icymind.network.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/etc/resolv.conf</string>
<string>/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist</string>
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
```