|
2010-02-09
, 17:08
|
Posts: 3 |
Thanked: 0 times |
Joined on Feb 2010
|
#102
|
|
2010-02-09
, 17:09
|
Posts: 318 |
Thanked: 49 times |
Joined on Nov 2009
|
#103
|
|
2010-02-09
, 18:48
|
Posts: 472 |
Thanked: 442 times |
Joined on Sep 2007
|
#104
|
|
2010-02-09
, 21:53
|
Posts: 3 |
Thanked: 0 times |
Joined on Feb 2010
|
#105
|
|
2010-02-09
, 22:01
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#106
|
well, this is what I'm using - based on a similar idea from his thread. Improvments are welcomed, I'm looking especially for "screen on" info in order to let he connection alive when screen is lit.
|
2010-02-09
, 22:50
|
Posts: 43 |
Thanked: 32 times |
Joined on Jan 2010
|
#107
|
Can we get a "latest and greatest" working version of that script slapped into a fresh thread or somewhere easily accessible in case modifcations/updates are made to it? I am interested in trying this out but would like to know which version is the one people are using with the most success at the moment.
sudo gainroot
vim /usr/local/bin/autodisconnect
#!/bin/sh sleep 180 a=`tail -1 /proc/net/route | cut -f1` b=`ifconfig $a | grep RX.b | cut -d"(" -f1 | cut -d: -f2` while [ "$a" != "Iface" ] do c=`expr $b + 1000` sleep 180 b=`ifconfig $a | grep RX.b | cut -d"(" -f1 | cut -d: -f2` a=`tail -1 /proc/net/route | cut -f1` if [ "$b" -lt "$c" -a "$a" != "Iface" ]; then dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true sleep 10 a=`tail -1 /proc/net/route | cut -f1` fi done exit 0
chmod a+x /usr/local/bin/autodisconnect
vim /etc/network/if-up.d/00_autodisconnect
!#/bin/sh #Run a script to disconnect idle networks console none script /usr/local/bin/autodisconnect end script exit 0
chmod a+x /etc/network/if-up.d/00_autodisconnect
while [ "$a" != "Iface" ]
while [ "$a" == "wlan0" ]
The Following 4 Users Say Thank You to azstunt For This Useful Post: | ||
|
2010-02-10
, 10:48
|
Posts: 241 |
Thanked: 69 times |
Joined on Dec 2009
@ Germany
|
#108
|
Nokia-N900-42-11:~# ps |grep auto 1288 root 2084 S /bin/sh -e -c /usr/local/bin/autodisconnect /bin/sh 1289 root 2084 S /bin/sh /usr/local/bin/autodisconnect
|
2010-02-10
, 14:38
|
Posts: 43 |
Thanked: 32 times |
Joined on Jan 2010
|
#109
|
Is it normal that two instances of the Script are running? I don't know how things in event.d work, so I am just curious.I did the Internetradio test again it it works great! Couldn't test ICQ idling though because it doesn't connect me since yesterday on my N900. But thats a different story. I'll update you when my ICQ is working again.Code:Nokia-N900-42-11:~# ps |grep auto 1288 root 2084 S /bin/sh -e -c /usr/local/bin/autodisconnect /bin/sh 1289 root 2084 S /bin/sh /usr/local/bin/autodisconnect
|
2010-02-10
, 16:13
|
|
Posts: 286 |
Thanked: 219 times |
Joined on Feb 2010
@ France
|
#110
|
#!/bin/sh logentry() { #SEND A STRING TO THIS FUNCTION TO APPEND IT TO THE LOG FILE echo -e "$1" >> ~/autoDCLog.txt echo "$1" } osnotify() { #SEND A STRING TO THIS FUNCTION TO GENERATE A SYSTEM POPUP dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"$1" } disconnect() { #DISCONNECT CURRENT CONNECTION dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true } #PREPARE INITIAL VARIABLES FOR TEMPORAL MONITORING OF NETWORK INTERFACES interface=`tail -1 /proc/net/route | cut -f1` packets_before=`grep $interface /proc/net/dev | awk '{ print $10 }'` #LOG MONITOR STARTUP TO FILE & NOTIFY USER VIA POPUP logentry "\nIdle Monitor Startup $(date)\nEVENTS:\n" #PERFORM MAIN MONITORING LOOPS while true; do #CHANGE THE NUMBER AFTER SLEEP TO SET THE NUMBER OF SECONDS BEFORE #THE INTERNET IS DISCONNECTED IF NO INTERNET ACTIVITY IS DETECTED sleep 300 interface=`tail -1 /proc/net/route | cut -f1` logentry "Current connexion : $interface" if [ "$interface" != "Iface" ]; then packets_after=`grep $interface /proc/net/dev | awk '{ print $10 }'` logentry "Packets : $packets_before -> $packets_after" if [ "$packets_before" = "$packets_after" ]; then disconnect osnotify "Connection closed due to inactivity" logentry "[Connection closed @ $(date)]" packets_before=0 else packets_before=$packets_after fi fi done exit
The Following User Says Thank You to calvin_42 For This Useful Post: | ||
|
Last edited by azstunt; 2010-02-09 at 16:47. Reason: EDIT: I believe you'll have problems once again... sorry about that. Check the script at #93 again.