Skip to content

Instantly share code, notes, and snippets.

@eriknelson
Created August 4, 2017 12:29
Show Gist options
  • Save eriknelson/6da124afec23d20de35585e96bbd448e to your computer and use it in GitHub Desktop.
Save eriknelson/6da124afec23d20de35585e96bbd448e to your computer and use it in GitHub Desktop.
#!/bin/bash
CONNAME="Raleigh (RDU2)"
CONID=$(nmcli con | grep Raleigh | awk '{print $3}')
ACTION=$1
if [[ "$ACTION" != "up" ]] && [[ "$ACTION" != "down" ]]; then
echo "ERROR: First argument must be 'up' or 'down'"
exit 1
elif [[ "$ACTION" == "up" ]]; then
echo "Connecting to RH VPN..."
nmcli con up --ask $CONID
elif [[ "$ACTION" == "down" ]]; then
echo "Disconnecting from RH VPN..."
nmcli con down $CONID
fi
nmcli con
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment