#!/bin/sh

PPPDIR=/etc/ppp
LOCKDEV=ppp0.pid

x=1
while [ x > 0 ]; do


`ifconfig -a | grep ppp | cut -f 1 -d : > /tmp/out`
if [ `cat /tmp/out | wc -l` = "1" ]; then
	sleep 300
else	

if [ -f /usr/local/bin/pppd ]; then
        if [ -f $PPPDIR/$LOCKDEV ]; then
                rm -f $PPPDIR/$LOCKDEV
        fi
/usr/local/bin/pppd -d call local
        if [ $? = "0" ]; then
                echo "PPP Started..."
                $PPPDIR/ip-up
        else
                echo "Startup failed, see syslog for details"
        fi
else
        echo "pppd not found, exiting..."
        exit 1
fi

	echo `date` > /tmp/pppcrash
fi

done
