[Lunar-commits] <lunar-tools> lnet: Use reliable ip link output.

Peter de Ridder peter at lunar-linux.org
Thu Apr 25 21:39:23 CEST 2013


commit 6af57bb0dd6d4df42cf3278fc8b485b4ee595801
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Thu, 25 Apr 2013 12:37:39 -0700
URL: https://github.com/lunar-linux/lunar-tools/commit/6af57bb0dd6d4df42cf3278fc8b485b4ee595801

lnet: Use reliable ip link output.
---
  prog/lnet | +5/-5     
  1 file changed, 5 insertions(+), 5 deletions(-)

--- a/prog/lnet
+++ b/prog/lnet
@@ -57,10 +57,10 @@ get_dev_list() {
 }
 
 get_dev_status() {
-  if ip link show $1 | grep -q 'state DOWN'; then
-    echo "[DOWN]"
-  else
+  if ip link show $1 | egrep -q '[<,]UP[,>]'; then
     echo "[ UP ]"
+  else
+    echo "[DOWN]"
   fi
 }
 
@@ -381,8 +381,8 @@ function ethernet_manage_device() {
         ;;
     esac
 
-    if ip link show $1 | grep -q 'state DOWN'; then
-        T=0; else T=1
+    if ip link show $1 | egrep -q '[<,]UP[,>]'; then
+        T=1; else T=0
     fi
 
     if [[ ( "$COMMAND" == "S" && "$TOGGLE" == "Start" && "$T" != "1" ) || 




More information about the Lunar-commits mailing list