summaryrefslogtreecommitdiff
path: root/files/sbin/test_vpn
blob: f69b5a70b145ddb2b651b5560a94203e85fc0557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
TESTHOST=4.2.2.4
ping -c 1 -w 5 -I tun0 $TESTHOST &>/dev/null

if [ $? -ne 0 ] ; then
        // IP not reachable -> restart openvpn
        /etc/init.d/openvpn restart
        sleep 10
        // Test Again
        ping -c 1 -w 5 -I tun0 $TESTHOST &>/dev/null
        if [ $? -ne 0 ] ; then
                /etc/init.d/openvpn stop
                ifdown wan
        fi
fi
contact: Jan Huwald // Impressum