home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #frontend for xnetload.
- #Barry Kauler 2004 www.goosee.com/puppy
-
- #the -a option for ifconfig will output all interfaces, up or down.
- #leave off -a and will only output interfaces that are up...
- #INTERFACETH="`ifconfig -a | grep "Link encap:Ethernet" | cut -f 1 -d " " | tr "\n" " "`"
- INTERFACEETH0="`ifconfig | grep "Link encap:Ethernet" | grep "eth0"`"
- INTERFACEETH1="`ifconfig | grep "Link encap:Ethernet" | grep "eth1"`"
- INTERFACEPPP0="`ifconfig | grep "Link encap:Point-Point" | grep "ppp0"`"
- INTERFACEPPP1="`ifconfig | grep "Link encap:Point-Point" | grep "ppp1"`"
- BUTTONETH0=""
- if [ ! "$INTERFACEETH0" = "" ];then
- BUTTONETH0="eth0:10,"
- fi
- BUTTONETH1=""
- if [ ! "$INTERFACEETH1" = "" ];then
- BUTTONETH1="eth1:11,"
- fi
- BUTTONPPP0=""
- if [ ! "$INTERFACEPPP0" = "" ];then
- BUTTONPPP0="ppp0:12,"
- fi
- BUTTONPPP1=""
- if [ ! "$INTERFACEPPP1" = "" ];then
- BUTTONPPP1="ppp1:13,"
- fi
- BUTTONS="${BUTTONETH0}${BUTTONETH1}${BUTTONPPP0}${BUTTONPPP1}Cancel:14"
- ACTIVEANY="${BUTTONETH0}${BUTTONETH1}${BUTTONPPP0}${BUTTONPPP1}"
- if [ ! "$ACTIVEANY" = "" ];then
- BLURB="Click on a button to monitor its traffic..."
- else
- BLURB="Nothing active, so click Cancel button..."
- fi
-
- xmessage -bg "#ffe0e0" -center -name "xnetloadshell" -title "Xnetload" -buttons "$BUTTONS" -file -<<MSG1
- This is a frontend to the Xnetload program.
- Xnetload will provide a real-time log of traffic
- over a eth0, eth1, ppp0 or ppp1 network interface.
- The first two are Ethernet interfaces.
- The second two are serial modem interfaces.
-
- The buttons below show what interfaces are currently
- active. If no interfaces are active, then the only
- button you will see below will be "Cancel".
-
- $BLURB
- MSG1
-
- case ${?} in
- 10)# eth0
- xnetload eth0 &
- ;;
- 11)# eth1
- xnetload eth1 &
- ;;
- 12)# ppp0
- xnetload ppp0 &
- ;;
- 13)# ppp1
- xnetload ppp1 &
- ;;
- 14)# cancel
- ;;
- 0)# window close-box...
- ;;
- 1)# window close-box...
- ;;
- esac
-