home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / xnetloadshell < prev    next >
Encoding:
Text File  |  2004-10-02  |  1.9 KB  |  70 lines

  1. #!/bin/sh
  2. #frontend for xnetload.
  3. #Barry Kauler 2004 www.goosee.com/puppy
  4.  
  5. #the -a option for ifconfig will output all interfaces, up or down.
  6. #leave off -a and will only output interfaces that are up...
  7. #INTERFACETH="`ifconfig -a | grep "Link encap:Ethernet" | cut -f 1 -d " " | tr "\n" " "`"
  8. INTERFACEETH0="`ifconfig | grep "Link encap:Ethernet" | grep "eth0"`"
  9. INTERFACEETH1="`ifconfig | grep "Link encap:Ethernet" | grep "eth1"`"
  10. INTERFACEPPP0="`ifconfig | grep "Link encap:Point-Point" | grep "ppp0"`"
  11. INTERFACEPPP1="`ifconfig | grep "Link encap:Point-Point" | grep "ppp1"`"
  12. BUTTONETH0=""
  13. if [ ! "$INTERFACEETH0" = "" ];then
  14.  BUTTONETH0="eth0:10,"
  15. fi
  16. BUTTONETH1=""
  17. if [ ! "$INTERFACEETH1" = "" ];then
  18.  BUTTONETH1="eth1:11,"
  19. fi
  20. BUTTONPPP0=""
  21. if [ ! "$INTERFACEPPP0" = "" ];then
  22.  BUTTONPPP0="ppp0:12,"
  23. fi
  24. BUTTONPPP1=""
  25. if [ ! "$INTERFACEPPP1" = "" ];then
  26.  BUTTONPPP1="ppp1:13,"
  27. fi
  28. BUTTONS="${BUTTONETH0}${BUTTONETH1}${BUTTONPPP0}${BUTTONPPP1}Cancel:14"
  29. ACTIVEANY="${BUTTONETH0}${BUTTONETH1}${BUTTONPPP0}${BUTTONPPP1}"
  30. if [ ! "$ACTIVEANY" = "" ];then
  31.  BLURB="Click on a button to monitor its traffic..."
  32. else
  33.  BLURB="Nothing active, so click Cancel button..."
  34. fi
  35.  
  36. xmessage -bg "#ffe0e0" -center -name "xnetloadshell" -title "Xnetload" -buttons "$BUTTONS" -file -<<MSG1
  37. This is a frontend to the Xnetload program.
  38. Xnetload will provide a real-time log of traffic
  39. over a eth0, eth1, ppp0 or ppp1 network interface.
  40. The first two are Ethernet interfaces.
  41. The second two are serial modem interfaces.
  42.  
  43. The buttons below show what interfaces are currently
  44. active. If no interfaces are active, then the only
  45. button you will see below will be "Cancel".
  46.  
  47. $BLURB
  48. MSG1
  49.  
  50. case ${?} in
  51.    10)# eth0
  52.      xnetload eth0 &
  53.      ;;
  54.    11)# eth1
  55.      xnetload eth1 &
  56.      ;;
  57.    12)# ppp0
  58.      xnetload ppp0 &
  59.      ;;
  60.    13)# ppp1
  61.      xnetload ppp1 &
  62.      ;;
  63.    14)# cancel
  64.      ;;
  65.    0)# window close-box...
  66.      ;;
  67.    1)# window close-box...
  68.      ;;
  69. esac
  70.