Created
August 27, 2012 16:19
-
-
Save lg0/3490009 to your computer and use it in GitHub Desktop.
Toggle VPN on/off and add/clean vpn routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on vpnToggle(vpnName) | |
tell application "System Events" | |
tell current location of network preferences | |
set VPNservice to service vpnName | |
set isConnected to connected of current configuration of VPNservice | |
if isConnected then | |
disconnect VPNservice | |
do shell script "./ip-down" with administrator privileges | |
else | |
do shell script "./ip-up" with administrator privileges | |
connect VPNservice | |
end if | |
end tell | |
end tell | |
do shell script "dscacheutil -flushcache" | |
end vpnToggle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
请教如果我只是把这两个文件cp到ppp下边,不每次执行ip-up/ip-down有什么影响么?