Commit 6d30111a authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric de Saint Martin

Added connectivity check before launching slapformat

parent 4d20ed03
...@@ -34,11 +34,31 @@ for service in rpcbind network-remotefs postfix ; do ...@@ -34,11 +34,31 @@ for service in rpcbind network-remotefs postfix ; do
done done
IPV6CHECK=ipv6.google.com IPV6CHECK=ipv6.google.com
IPV4CHECK=google.com
IPV6WAITTIME=5
# Test ipv6 connectivity and if not working use openvpn # Test ipv4/ipv6 connectivity and if not working use openvpn
# and wait for it to be ready # and wait for it to be ready
/etc/init.d/openvpn stop /etc/init.d/openvpn stop
ping -c 2 $IPV4CHECK
while [ $? != 0 ]; do
sleep 5
ping -c 2 $IPV4CHECK
done
echo """Ipv4 connection ok"""
# Wait for native ipv6 connection to be ready
i=0
ping6 -c 2 $IPV6CHECK ping6 -c 2 $IPV6CHECK
while [[ $? != 0 ]] && [[ $i < $IPV6WAITTIME ]]
do
let i++
sleep 1
ping6 -c 2 $IPV6CHECK
done
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
echo """ Starting openVPN """ echo """ Starting openVPN """
/etc/init.d/openvpn start /etc/init.d/openvpn start
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment