1 |
commit: 14938c29cefe869872b987f8e606da72024fa8bb |
2 |
Author: bell07 <web.alexander <AT> web <DOT> de> |
3 |
AuthorDate: Tue Dec 12 20:51:55 2017 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 12 22:29:34 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=14938c29 |
7 |
|
8 |
net-online: wait for ping_test_host |
9 |
|
10 |
The script should wait till the ping host is available or timeout reached |
11 |
Closes : #179 |
12 |
Closes : #191 |
13 |
|
14 |
init.d/net-online.in | 8 ++++++-- |
15 |
1 file changed, 6 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/init.d/net-online.in b/init.d/net-online.in |
18 |
index 5ea6bf64..1175f29c 100644 |
19 |
--- a/init.d/net-online.in |
20 |
+++ b/init.d/net-online.in |
21 |
@@ -63,8 +63,12 @@ start () |
22 |
if [ $rc -eq 0 ] && yesno ${include_ping_test:-no}; then |
23 |
ping_test_host="${ping_test_host:-google.com}" |
24 |
if [ -n "$ping_test_host" ]; then |
25 |
- ping -c 1 $ping_test_host > /dev/null 2>&1 |
26 |
- rc=$? |
27 |
+ while $infinite || [ $timeout -gt 0 ]; do |
28 |
+ ping -c 1 $ping_test_host > /dev/null 2>&1 |
29 |
+ rc=$? |
30 |
+ [ $rc -eq 0 ] && break |
31 |
+ : $((timeout -= 1)) |
32 |
+ done |
33 |
fi |
34 |
fi |
35 |
eend $rc "The network is offline" |