dotfiles/dot_local/scripts/executable_toggle-vpn.sh
2021-04-15 02:29:54 -05:00

24 lines
344 B
Bash

#!/bin/bash
# https://robertbasic.com/blog/toggle-a-vpn-connection/
VPN=$1
if [ -z "$VPN" ]
then
exit 1
fi
ACTIVE=`nmcli con show --active | grep "$VPN"`
if [ -z "$ACTIVE" ]
then
nmcli con up id "$VPN"
notify-send "VPN $VPN" "Connected."
else
nmcli con down id "$VPN"
notify-send "VPN $VPN" "Disconnected."
fi
exit 0