improve test_connection (#548)

This commit is contained in:
Daniel Hansson 2018-05-22 22:15:18 +02:00 committed by GitHub
parent 31c58e24f3
commit 33d97ff4f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

20
lib.sh
View File

@ -207,19 +207,27 @@ ip link set "$IFACE" down
wait
ip link set "$IFACE" up
wait
check_command service network-manager restart
echo "Checking connection..."
sleep 3
if ! nslookup github.com
check_command service network-manager restart
sleep 2
if nslookup github.com
then
echo "Online!"
elif ! nslookup github.com
then
echo "Trying to restart networking service..."
check_command service networking restart
fi
if ! nslookup github.com
then
if nslookup github.com
then
echo "Online!"
fi
else
if ! nslookup github.com
then
msg_box "Network NOT OK. You must have a working network connection to run this script
If you think that this is a bug, please report it to https://github.com/nextcloud/vm/issues."
exit 1
fi
fi
}