add a test to see whether ethtool is available before trying to run it

This commit is contained in:
Bryan Boreham committed 2014-08-28 17:20:17 +01:00
1 parent 9924f420e5
commit dced4e3d6f
1 file changed
+6 -1
+6 -1
View File
@@ -87,7 +87,12 @@ ip netns exec $NSPID ip link set $GUEST_IFNAME name $CONTAINER_IFNAME
ip netns exec $NSPID ip addr add $IPADDR dev $CONTAINER_IFNAME
ip netns exec $NSPID ip link set $CONTAINER_IFNAME up
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
if [ command -v ethtool >/dev/null 2>&1 ]
then
ip netns exec $NSPID ethtool -K $IFACE tx off > /dev/null
else
echo "Unable to run ethtool command; continuing without it" >&2
fi
[ -f /var/run/netns/$NSPID ] && rm -f /var/run/netns/$NSPID