Last active
April 13, 2020 20:08
-
-
Save sloanlance/0bd8e7a2be8e1f1377971d41e07bcc8f to your computer and use it in GitHub Desktop.
Mac OS X 10.11-ish shell script to toggle VPN connection
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
#!/bin/sh -- | |
## | |
## Requires your VPN service to be already configured | |
## and your password saved in your keychain. | |
## | |
## Alter the VPN variable below to contain the name | |
## of your configured VPN service before running. | |
## | |
VPN='YOUR_VPN_NAME' | |
scutil --nc status "$VPN" | grep -q 'Connected' | |
if [ $? -eq 0 ]; then | |
scutil --nc stop "$VPN" | |
else | |
scutil --nc start "$VPN" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment