From 5ea20a309fb11e31a8077e2bcf307291f7410f36 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 17 Dec 2002 17:45:38 +0000 Subject: more rhgb tweaks have a loop for checking link state instead of a static 'sleep 5' --- sysconfig/network-scripts/network-functions | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index ad9e40d3..49d9cca5 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -131,9 +131,15 @@ check_device_down () check_link_down () { if [ -x /sbin/mii-tool ]; then - LC_ALL=C ip link show $1 2>/dev/null| grep -q UP || ip link set $1 up >/dev/null 2>&1 - # wait for link to come up - sleep 5 + if ! LC_ALL=C ip link show $1 2>/dev/null| grep -q UP ; then + ip link set $1 up >/dev/null 2>&1 + timeout=0 + while [ $timeout -le 10 ]; do + LC_ALL=C ip link show $1 2>/dev/null | grep -q UP && break + usleep 500000 + timeout=$((timeout+1)) + done + fi /sbin/mii-tool $1 >/dev/null 2>&1 || return 1 output=`LC_ALL=C /sbin/mii-tool $1 2>&1` if echo $output | grep -q "Operation not supported"; then -- cgit v1.2.1