Advertisement
s243a

testInterface() - /etc/rc.d/rc.network - puppylinux

Oct 9th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.24 KB | None | 0 0
  1. # lines 136 to 167 of /etc/rc.d/rc.network
  2. # http://www.pearltrees.com/s243a/testinterface-puppylinux/id16440735
  3. # cutdown version of this function (can't just source net-setup.sh...)
  4. testInterface()
  5. {
  6.   #INTERFACE="$1"
  7.   echo -n "cheching if interface $INTERFACE is alive..."
  8.   #sleep 1 # rerwin's original solution
  9.   # no, move the sleep 1 so is only used for wireless
  10.   #091108 old ifplugstatus now -0.18, latest is just 'ifplugstatus'...
  11.   IFPLUGOLD=ifplugstatus
  12.   IFPLUGNEW=ifplugstatus
  13.   [ -x /sbin/ifplugstatus-0.18 ] && IFPLUGOLD=ifplugstatus-0.18
  14.   [ -x /sbin/ifplugstatus-0.25 ] && IFPLUGNEW=ifplugstatus-0.25
  15.   if ! $IFPLUGOLD "$INTERFACE" | grep -F -q 'link beat detected' ;then
  16.     sleep 1
  17.     if ! $IFPLUGNEW "$INTERFACE" | grep -F -q 'link beat detected' ;then
  18.       sleep 2
  19.       if ! $IFPLUGOLD "$INTERFACE" | grep -F -q 'link beat detected' ;then
  20.         sleep 2
  21.         if ! $IFPLUGNEW "$INTERFACE" | grep -F -q 'link beat detected' ;then
  22.           # add ethtool test, just in case it helps at times...
  23.           sleep 1
  24.           if ! ethtool "$INTERFACE" | grep -Fq 'Link detected: yes' ; then
  25.             echo "no"
  26.             return 1
  27.           fi
  28.         fi
  29.       fi
  30.     fi
  31.   fi
  32.   echo "yes"
  33.   return 0
  34. } # end of testInterface
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement