> I'm curious how to get pppd to auto redial when my connection
> dies.

<snipalot>

Just respawning the pppd is not sufficient, I had times when pppd ran and
the ppp0 interface was visible but did not have an IP address. IMHO the pppd
should be changed that so it never quits, doesn't run twice on the same
interface and retries constantly. In the meantime, I'm using the script
below, called "pppwatch". If the ppp connection is down for 15 seconds, ppp
is restarted. Arguments are the interface (ppp0), the dsl-provider and the
ethernet interface. The script would have to be changed if you need more
than one ppp connection (sometimes it kills all pppds)

I have pppwatch in /etc/ppp/ and start it in /etc/network/interfaces:
auto ppp0
iface ppp0 inet ppp
        pre-up ip link set eth1 up
        provider cybernet eth1
        up /etc/ppp/pppwatch ppp0 cybernet eth1 >/dev/null </dev/null 2>&1 &

#!/bin/sh

IFACE=$1
PROVIDER=$2
ETHFACE=$3

PIDFILE=/var/run/pppwatch-$IFACE.pid

echo "Watching $IFACE $PROVIDER $ETHFACE"

if [ -r $PIDFILE ]; then
    PID=`cat $PIDFILE`
    if kill -CONT $PID 2>/dev/null; then
        #already running
        exit
    fi
fi

echo $$ >$PIDFILE

while true; do
    if ip addr show $IFACE | grep inet >/dev/null 2>&1; then
    else
        sleep 10
        if ip addr show $IFACE | grep inet >/dev/null 2>&1; then
        else
            #at least 10 seconds without ppp

            echo "$0: Restarting Networking, no $IFACE" |logger

            PID=`ps axw | grep "[ /]pppd call $PROVIDER "`
            if test -n "$PID" ; then
                echo "$0: killing pppd" |logger
                killall -9 pppd
            fi

            sleep 5
            #try to restart ppp service
            pon $PROVIDER $ETHFACE

        fi
    fi
    sleep 5
done



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to