diff options
Diffstat (limited to 'sysconfig/network-scripts/ifdown')
-rwxr-xr-x | sysconfig/network-scripts/ifdown | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 34a10c53..b9a7a1fc 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -12,14 +12,14 @@ cd /etc/sysconfig/network-scripts CONFIG=$1 [ -z "$CONFIG" ] && { - echo $"usage: ifdown <device name>" >&2 + echo $"usage: ifdown <configuration>" >&2 exit 1 } need_config "${CONFIG}" [ -f "$CONFIG" ] || { - echo $"usage: ifdown <device name>" >&2 + echo $"usage: ifdown <configuration>" >&2 exit 1 } @@ -46,8 +46,11 @@ if [ "$_use_nm" = "true" ]; then DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }") fi if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then - nmcli dev disconnect iface "$DEVICE" - exit $? + if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | egrep -q "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then + nmcli dev disconnect iface "$DEVICE" + exit $? + fi + exit 0 fi echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2 exit 0 |