From eb0647afd3619ceff6abc2278bbb3950333f6207 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Fri, 23 Dec 2016 01:01:19 -0600 Subject: [PATCH] rename to more appropiete name --- scripts/stat-netdev | 55 ++++++++++++++++++++++++++++++++++++++++++++ scripts/test-netdev | 56 +-------------------------------------------- 2 files changed, 56 insertions(+), 55 deletions(-) create mode 100755 scripts/stat-netdev mode change 100755 => 120000 scripts/test-netdev diff --git a/scripts/stat-netdev b/scripts/stat-netdev new file mode 100755 index 0000000..9d3f83e --- /dev/null +++ b/scripts/stat-netdev @@ -0,0 +1,55 @@ +#!/bin/bash + +source scan-netdev +source test-variables + +check_listed_mac () { + if [[ -n $LISTED_MAC ]] ; then + echo "$RES_ERROR: $BLD$MAC$OFF belongs to $LISTED_DEV" + fi +} + +while [[ 1 ]] ; do + clear + date + for DEV in \ + `cat /proc/net/dev \ + | grep -v 'lo:' \ + | grep ':' \ + | cut -d ':' -f 1` + do + MAC=`cat /sys/class/net/$DEV/address` + LISTED=`cat $OUTPUT_DIR/netdev.lst | grep $DEV` + MATCHING_MAC=`echo $LISTED | grep $MAC` + LISTED_MAC=`cat $OUTPUT_DIR/netdev.lst | grep $MAC` + LISTED_DEV=`echo $LISTED_MAC | cut -d ' ' -f 1` + LINKING=`cat /sys/class/net/$DEV/operstate` + if [[ "$LINKING" == "up" ]] ; then + echo -n "$GRN$DEV$OFF " + else + echo -n "$RED$DEV$OFF " + fi + if [[ -z $LISTED ]] ; then + echo "$MAC $RES_ERROR: Device $BLD$DEV$OFF not listed" + check_listed_mac + elif [[ -z $MATCHING_MAC ]] ; then + echo -n "$RES_ERROR: Mac addres $BLD$MAC$OFF " + echo "not matching for $BLD$DEV$OFF" + check_listed_mac + else + echo "$MAC $LINKING" + fi + done + for DEV in \ + `cat $OUTPUT_DIR/netdev.lst | sed 's/#.*$//' | cut -d ' ' -f 1` + do + STILL_THERE=`cat /proc/net/dev | grep $DEV` + if [[ -z $STILL_THERE ]] ; then + echo "$BLD$DEV$OFF $RES_ERROR: Device missing" + check_listed_mac + fi + done + sleep 2 +done + + diff --git a/scripts/test-netdev b/scripts/test-netdev deleted file mode 100755 index 9d3f83e..0000000 --- a/scripts/test-netdev +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -source scan-netdev -source test-variables - -check_listed_mac () { - if [[ -n $LISTED_MAC ]] ; then - echo "$RES_ERROR: $BLD$MAC$OFF belongs to $LISTED_DEV" - fi -} - -while [[ 1 ]] ; do - clear - date - for DEV in \ - `cat /proc/net/dev \ - | grep -v 'lo:' \ - | grep ':' \ - | cut -d ':' -f 1` - do - MAC=`cat /sys/class/net/$DEV/address` - LISTED=`cat $OUTPUT_DIR/netdev.lst | grep $DEV` - MATCHING_MAC=`echo $LISTED | grep $MAC` - LISTED_MAC=`cat $OUTPUT_DIR/netdev.lst | grep $MAC` - LISTED_DEV=`echo $LISTED_MAC | cut -d ' ' -f 1` - LINKING=`cat /sys/class/net/$DEV/operstate` - if [[ "$LINKING" == "up" ]] ; then - echo -n "$GRN$DEV$OFF " - else - echo -n "$RED$DEV$OFF " - fi - if [[ -z $LISTED ]] ; then - echo "$MAC $RES_ERROR: Device $BLD$DEV$OFF not listed" - check_listed_mac - elif [[ -z $MATCHING_MAC ]] ; then - echo -n "$RES_ERROR: Mac addres $BLD$MAC$OFF " - echo "not matching for $BLD$DEV$OFF" - check_listed_mac - else - echo "$MAC $LINKING" - fi - done - for DEV in \ - `cat $OUTPUT_DIR/netdev.lst | sed 's/#.*$//' | cut -d ' ' -f 1` - do - STILL_THERE=`cat /proc/net/dev | grep $DEV` - if [[ -z $STILL_THERE ]] ; then - echo "$BLD$DEV$OFF $RES_ERROR: Device missing" - check_listed_mac - fi - done - sleep 2 -done - - diff --git a/scripts/test-netdev b/scripts/test-netdev new file mode 120000 index 0000000..b945c4c --- /dev/null +++ b/scripts/test-netdev @@ -0,0 +1 @@ +stat-netdev \ No newline at end of file