aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2013-04-02 17:58:35 +0200
committerLukas Nykryn <lnykryn@redhat.com>2013-07-18 09:38:34 +0200
commitc3c5d9cab4d8a1e8414bd099400a716639b4844b (patch)
treef6535586a3f4577126c1f6e38f2aa1cbd9130a9f
parent119e56c347539364bbdf215d3ca1cbcb7f3dd888 (diff)
downloadinitscripts-c3c5d9cab4d8a1e8414bd099400a716639b4844b.tar
initscripts-c3c5d9cab4d8a1e8414bd099400a716639b4844b.tar.gz
initscripts-c3c5d9cab4d8a1e8414bd099400a716639b4844b.tar.bz2
initscripts-c3c5d9cab4d8a1e8414bd099400a716639b4844b.tar.xz
initscripts-c3c5d9cab4d8a1e8414bd099400a716639b4844b.zip
ifdown: don't call nmcli on interface that is alread down
-rwxr-xr-xsysconfig/network-scripts/ifdown7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index db045da4..c3c1bc7a 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -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
fi