Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Last active May 21, 2019 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e-minguez/9a567a106f0cfa9101023fac8a0093bd to your computer and use it in GitHub Desktop.
Save e-minguez/9a567a106f0cfa9101023fac8a0093bd to your computer and use it in GitHub Desktop.
#!/bin/sh
# /etc/NetworkManager/dispatcher.d/99-vpn-home
VPN_NAME="HOME"
ESSID="CircleCI+CloudNative"
interface=$1 status=$2
case $status in
up|vpn-down)
if iwgetid | grep -qs ":\"$ESSID\""; then
nmcli con up id "$VPN_NAME"
fi
;;
down)
if iwgetid | grep -qs ":\"$ESSID\""; then
if nmcli con show --active | grep "$VPN_NAME"; then
nmcli con down id "$VPN_NAME"
fi
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment