Created
July 26, 2015 21:18
-
-
Save andreasvirkus/633926c1bef6294e089a to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
# vpntog [vpn.name] [on/off/state] | (Dis)connect to the given VPN | |
if [ "$2" == 'on' ]; then | |
nmcli con up id $1 | |
echo vpn @$1 > on | |
elif [ "$2" == 'off' ]; then | |
nmcli con down id $1 | |
echo proxy @$1 > off | |
elif [ "$2" == 'state' ]; then | |
state=$(nmcli c show --active id "$1" | less) | |
echo Current state of vpn: $state | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment