diff options
author | Michael K. Johnson <johnsonm@redhat.com> | 1999-09-08 20:14:38 +0000 |
---|---|---|
committer | Michael K. Johnson <johnsonm@redhat.com> | 1999-09-08 20:14:38 +0000 |
commit | 40ecc9bedb8b80aea208404be2c9eb23fa52ff55 (patch) | |
tree | d171e3319033fae76fe800e9bd4f3a1a04392916 /sysconfig/network-scripts/ifdown | |
parent | 8f705efdedc37e43620b8ec88f9b156f85a1f2d0 (diff) | |
download | initscripts-40ecc9bedb8b80aea208404be2c9eb23fa52ff55.tar initscripts-40ecc9bedb8b80aea208404be2c9eb23fa52ff55.tar.gz initscripts-40ecc9bedb8b80aea208404be2c9eb23fa52ff55.tar.bz2 initscripts-40ecc9bedb8b80aea208404be2c9eb23fa52ff55.tar.xz initscripts-40ecc9bedb8b80aea208404be2c9eb23fa52ff55.zip |
make ifdown synchronous modulo timeout
Diffstat (limited to 'sysconfig/network-scripts/ifdown')
-rwxr-xr-x | sysconfig/network-scripts/ifdown | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 6f02c394..5018e708 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -19,7 +19,9 @@ CONFIG=$1 if [ $UID != 0 ]; then if [ -x /usr/sbin/usernetctl ]; then - exec /usr/sbin/usernetctl $CONFIG down + if /usr/sbin/usernetctl $CONFIG report ; then + exec /usr/sbin/usernetctl $CONFIG down + fi fi echo "Users cannot control this device." >&2 exit 1 @@ -31,14 +33,7 @@ DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"` OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${DEVICETYPE}" if [ -x $OTHERSCRIPT ]; then - $OTHERSCRIPT $CONFIG $2 - exit $? -fi - -if echo $DEVICE | grep -q ':' ; then - ISALIAS=yes -else - ISALIAS=no + exec $OTHERSCRIPT $CONFIG $2 fi if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then @@ -46,6 +41,17 @@ if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then fi ifconfig ${DEVICE} down +# wait up to 5 seconds for device to actually come down... +waited=0 +while ! check_device_down && [ "$waited" -lt 50 ] ; do + usleep 100000 + waited=$(($waited+1)) +done + +if [ "$retcode" = 0 ] ; then + /etc/sysconfig/network-scripts/ifdown-post $CONFIG + # do NOT use $? because ifdown should return whether or not + # the interface went down. +fi -exec /etc/sysconfig/network-scripts/ifdown-post $CONFIG - +exit $retcode |