Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vpn autoconnect #cli #network
#! /bin/bash
REQUIRED_CONNECTION_NAME="Wired connection 1"
VPN_CONNECTION_NAME="bender"
activ_con=$(nmcli con status | grep "${REQUIRED_CONNECTION_NAME}")
activ_vpn=$(nmcli con status | grep "${VPN_CONNECTION_NAME}")
if [ "${activ_con}" -a ! "${activ_vpn}" ];
then
nmcli con up id "${VPN_CONNECTION_NAME}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.