Added script file
This commit is contained in:
parent
3a7f95c344
commit
c53b242508
23
vpnnew.sh
Executable file
23
vpnnew.sh
Executable 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
|
||||||
Loading…
x
Reference in New Issue
Block a user