Created
November 6, 2015 20:15
-
-
Save a-morales/3f6bde90eb1cc286f6f2 to your computer and use it in GitHub Desktop.
connect to VPN
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
#!/usr/bin/env bash | |
# change FOO to whatever the VPN connection name is called | |
# set FOO_VPN_PASS as the password to automatically connect | |
# for manual connection delete lines 10-12 | |
/usr/bin/env osascript <<-EOF | |
tell application "System Events" | |
set status to do shell script "scutil --nc status FOO" | |
if status does not start with "Connected" then | |
do shell script "scutil --nc start FOO" | |
delay 2 | |
keystroke (system attribute "FOO_VPN_PASS") | |
keystroke return | |
else | |
log "Already Connected" | |
end if | |
end tell | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment