View Single Post
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#27
This script should disconnect from network (wlan or GPRS/UMTS) after 5 to 10 minutes of no received packets:

Code:
#!/bin/sh
a=`ifconfig phonet0 | grep RX.p | cut -d: -f2`
c=`ifconfig wlan0 | grep RX.p | cut -d: -f2`
b=$a
d=$c

while true ; do
        sleep 300
        a=`ifconfig phonet0 | grep RX.p | cut -d: -f2`
        c=`ifconfig wlan0 | grep RX.p | cut -d: -f2`
        if [ "$a" == "$b" -a "$c" == "$d" ] ; then
                dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
        fi
        b=$a
        d=$c
done
 

The Following 2 Users Say Thank You to Matan For This Useful Post: