aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbell07 <web.alexander@web.de>2017-12-12 21:51:55 +0100
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-12-12 16:29:34 -0600
commit14938c29cefe869872b987f8e606da72024fa8bb (patch)
tree4f18c5a4fe3fc23c17ff2adb86415febd7a8c91b
parent8bf501aaf2cb60b8ddf1b2fa2d1ba0ef970fb790 (diff)
net-online: wait for ping_test_host
The script should wait till the ping host is available or timeout reached Closes : #179 Closes : #191
-rw-r--r--init.d/net-online.in8
1 files changed, 6 insertions, 2 deletions
diff --git a/init.d/net-online.in b/init.d/net-online.in
index 5ea6bf64..1175f29c 100644
--- a/init.d/net-online.in
+++ b/init.d/net-online.in
@@ -63,8 +63,12 @@ start ()
if [ $rc -eq 0 ] && yesno ${include_ping_test:-no}; then
ping_test_host="${ping_test_host:-google.com}"
if [ -n "$ping_test_host" ]; then
- ping -c 1 $ping_test_host > /dev/null 2>&1
- rc=$?
+ while $infinite || [ $timeout -gt 0 ]; do
+ ping -c 1 $ping_test_host > /dev/null 2>&1
+ rc=$?
+ [ $rc -eq 0 ] && break
+ : $((timeout -= 1))
+ done
fi
fi
eend $rc "The network is offline"