Created
December 6, 2012 19:19
-
-
Save tskrynnyk/4227436 to your computer and use it in GitHub Desktop.
NetworkManager dispatcher for connect to a VPN after a network-connection is established.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| IF_NAME="Ifupdown (eth0)" | |
| VPN_NAME="My VPN" # default VPN | |
| active_if=$(nmcli con status | grep "${IF_NAME}") | |
| #active_vpn=$(nmcli con status | grep "${VPN_NAME}") | |
| active_vpn=$(nmcli -t -f VPN con status | grep 'yes') | |
| if [ "${active_if}" -a ! "${active_vpn}" ]; then | |
| su tomasz -c "nmcli con up id \"${VPN_NAME}\"" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment