Home | Scripts | Demo | About | Links

script: killppp (download)
purpose: kill ppp pid after n time of no traffic
requires: standard GNU commands, /proc fs
version: 1.0
usage: killppp [-hl] <pid> <n>s|m|h|d
     <pid>, process ID 
     <n>s|m|h|d, n seconds|minutes|hours|days of no traffic
     -h, usage and options (this help)
     -m, manual
     -l, see this script"


    killppp is a shell script that kills the ppp process after
    specified time of no traffic. This is especially useful
    for dial-up users who pay per time-unit of being connected.
    The typical use for it, is to start a large download along
    with killppp and go away. The script will shut down ppp
    after the downloading is done. Thus saving unnecessary
    cost of unused network connectivity.

    Depending on how your linux is configured you may need to
    be root to have the right to kill a ppp process and it may
    have to be the ppp daemon (pppd).

    To find the pid of your ppp process type: ps aux | grep ppp

    How this script works? Once activated, killppp checks every
    minute for network traffic on the ppp0 device. As long as
    data is passing through, killppp does nothing. Upon no 
    traffic killppp starts counting time until it reaches the
    specified time and kills the ppp process.


    killppp 8249 5m

    This will kill the process 8249 after 5 minutes of no