Added script file

This commit is contained in:
Benjamyn Love 2018-07-09 10:38:43 +10:00
parent 3a7f95c344
commit c53b242508

23
vpnnew.sh Executable file
View File

@ -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