[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ifconfig ppp0



> after closing a pptp connection kiling the pppd & pptp processes and 
> removing the /var/run/pptp/* file, I have to restart the machine to get 
> another connection. Is this expected behavior?

no, of course.

> Doing an ifconfig -m ppp0 still shows the details of the previous 

a copy&paste of the output of ifconfig would have been more clear and
useful ;)

here is the script i use to disconnect/connect/reconnect/etc. it's a bit
rough but as usual it's fine for me ;) hope it can be useful to you too

(btw it's basically a major modification of pptp-reconnect wich is
included with the pptp port)



#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
MODEMIP=192.168.9.1


function dolog {
    a=`date "+%b %e %H:%M:%S"`
    b=`hostname -s`
    echo $a $b "adsl["$$"]:" $* >> /var/log/ppp.log
}


if [ "$MODEMIP" = "" ]; then
        dolog "No modem ip specified"
        exit 1
fi

ps ax | grep "[p]ppd" > /dev/null
if [ $? -eq 0 ]; then
    dolog "Killing pppd"
    kill -HUP `cat /var/run/ppp0.pid`

    sleep 3
    pfctl -F all
    pfctl -f /etc/pf.conf
fi
ps ax | grep "[p]ptp" > /dev/null
if [ $? -eq 0 ]; then
    dolog "Killing pptp"
    kill `ps ax | grep '[p]ptp: call' | awk '{ print $1 }'`

    sleep 5
fi

if [ -S /var/run/pptp/$MODEMIP ]; then
    rm -f /var/run/pptp/$MODEMIP
fi

if [ "X"$1 = "Xstop" ]; then
    squid -k shutdown
    exit 0
fi


dolog "======================="
dolog "Establishing connection"

pptp $MODEMIP >> /var/log/ppp.log 2>&1

a=0
until ifconfig ppp0 | grep UP > /dev/null; do
    sleep 1

    let a=a+1
    if [ $a -gt 60 ]; then
        dolog "Could not connect"
        exit 1
    fi
done

pfctl -f /etc/pf.adsl
squid
ddclient -daemon=0


-- 

    Shiva

  "Better true to yourself
Than a perfect shadow
       Of somebody else
     An empty shell"

(MrBig, My new religion)



Visit your host, monkey.org