From c53b2425089c55d518cadf93ac7ba2841a7f4861 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Mon, 9 Jul 2018 10:38:43 +1000 Subject: [PATCH] Added script file --- vpnnew.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 vpnnew.sh 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