[ILUG] killing ppp after inactivity...

From: kevin lyda (kevin at domain suberic.net)
Date: Sun 06 May 2001 - 18:37:32 IST


for those of us too lazy to set up diald, there's always the question
of turning off ppp connections when we're tired but have a large
ftp session going, this script might be of use:

    #/bin/sh
    echo -e "time\t total\t\tdelta\tdeltas below 30 (exit when > 4)"
    o=0
    f=0
    while /sbin/ifconfig | grep -q ppp0; do
        n=`/sbin/ifconfig ppp0|grep RX|cut -d: -f2|cut -d\ -f1`
        if [ $[ $n - $o ] -lt 30 ]; then
            f=$[ $f + 1 ]
            if [ $f -gt 4 ]; then
                /sbin/ifdown ppp0
            fi
        fi
        date "+%T $n%t%t"$[ $n - $o ]"%t$f"
        o=$n
        sleep 15
    done

i save this under pppwait in my bin dir.

kevin

-- 
kevin at domain suberic.net          "nobody likes a monkey on their back.  i had
fork()'ed on 37058400      three.  they were cramping my style.  it was
meatspace place: home      time to get rid of them."
http://suberic.net/~kevin                --porter, "payback"


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:12 GMT