1234567891011121314151617181920212223242526272829 |
- #!/bin/bash
- #130505 rerwin: notify network_tray of analog/wireless connection type
- #Disconnect from ISP and update usage statistics...
- [ "`ps aux | grep -w 'wvdial' | grep -v 'grep'`" = "" ] && exit
- #Collect transmission data...
- if [ -e /var/local/pupdial/isp ];then
- ACTIVE_INTERFACE="`ifconfig | grep -m 1 -o '^ppp[0-9]'`"
- if [ "$ACTIVE_INTERFACE" != "" ] \
- && [ -d /sys/class/net/${ACTIVE_INTERFACE}/statistics ];then
- RX_BYTES="`cat /sys/class/net/${ACTIVE_INTERFACE}/statistics/rx_bytes`"
- TX_BYTES="`cat /sys/class/net/${ACTIVE_INTERFACE}/statistics/tx_bytes`"
- RX_BYTES_MONTH=`cat /var/local/pupdial/isp/rx_bytes_month`
- RX_BYTES_MONTH=`expr $RX_BYTES_MONTH + $RX_BYTES`
- echo -n "$RX_BYTES_MONTH" > /var/local/pupdial/isp/rx_bytes_month
- TX_BYTES_MONTH=`cat /var/local/pupdial/isp/tx_bytes_month`
- TX_BYTES_MONTH=`expr $TX_BYTES_MONTH + $TX_BYTES`
- echo -n "$TX_BYTES_MONTH" > /var/local/pupdial/isp/tx_bytes_month
- fi
- fi
- rm -f /etc/ppp/peers/wvdial
- rm -f /etc/ppp/peers/wvdial-pipe 2>/dev/null #432
- killall wvdial
- killall pppd
- rm -f /tmp/.network_tray-use_analog_dialup_icons 2>/dev/null #130505
|