2020-11-20 23:54:18 -06:00
|
|
|
#!/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"
|
2021-04-15 02:29:54 -05:00
|
|
|
notify-send "VPN $VPN" "Connected."
|
2020-11-20 23:54:18 -06:00
|
|
|
else
|
|
|
|
nmcli con down id "$VPN"
|
2020-11-21 04:19:17 -06:00
|
|
|
notify-send "VPN $VPN" "Disconnected."
|
2020-11-20 23:54:18 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|