dotfiles/dot_local/scripts/executable_toggle-vpn.sh

24 lines
304 B
Bash
Raw Normal View History

2020-11-21 05:54:18 +00: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"
else
nmcli con down id "$VPN"
2020-11-21 10:19:17 +00:00
notify-send "VPN $VPN" "Disconnected."
2020-11-21 05:54:18 +00:00
fi
exit 0