diff --git a/vpnnew.sh b/vpnnew.sh new file mode 100755 index 0000000..0ba6234 --- /dev/null +++ b/vpnnew.sh @@ -0,0 +1,23 @@ +#!/bin/bash +tmpfile="/tmp/connectedto" +vpnconfpath="/etc/openvpn/client" + +function weAreConnected () { +if [ -f $tmpfile ] +then + echo "We are connected to `cat $tmpfile`" + if [[ $1 == "stop" ]] + then + systemctl stop openvpn-client@`cat $tmpfile` + fi +fi + +} + +## Check for tunnel device to see if we are connected +if [ -d /sys/class/net/tun0 ] +then + weAreConnected +else + connected=0 +fi