12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/sh
- ACTIVE_INTERFACE=""
- [ -f /tmp/sns_interface_success ] && ACTIVE_INTERFACE="`cat /tmp/sns_interface_success`"
- [ ! "$ACTIVE_INTERFACE" ] && ACTIVE_INTERFACE="`ifconfig | grep '^[a-z]' | grep -v '^lo' | grep -v '^ppp' | grep 'Link encap:Ethernet' | cut -f 1 -d ' ' | head -n 1`"
- if [ "$ACTIVE_INTERFACE" ];then
- if [ -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`"
- echo -n "$RX_BYTES" > /var/local/sns/rx_bytes_session
- echo -n "$TX_BYTES" > /var/local/sns/tx_bytes_session
- RX_BYTES_MONTH=`cat /var/local/sns/rx_bytes_month`
- RX_BYTES_MONTH=`expr $RX_BYTES_MONTH + $RX_BYTES`
- echo -n "$RX_BYTES_MONTH" > /var/local/sns/rx_bytes_month
- TX_BYTES_MONTH=`cat /var/local/sns/tx_bytes_month`
- TX_BYTES_MONTH=`expr $TX_BYTES_MONTH + $TX_BYTES`
- echo -n "$TX_BYTES_MONTH" > /var/local/sns/tx_bytes_month
- fi
- fi
- [ "`pidof wpa_supplicant`" != "" ] && wpa_cli terminate
- if [ "`grep 'net-setup.sh' /usr/local/bin/defaultconnect`" = "" ];then
- for ONENETIF in `ifconfig | grep -E '^wifi[0-9]|^wlan[0-9]|^eth[0-9]' | cut -f 1 -d ' ' | tr '\n' ' '`
- do
- ifconfig $ONENETIF down 2> /dev/null
- [ "`iwconfig | grep "^${ONENETIF}" | grep "ESSID"`" != "" ] && iwconfig $ONENETIF essid off
- dhcpcd --release $ONENETIF 2>/dev/null
- done
- else
- /etc/rc.d/rc.network stop
- fi
|