#!/usr/bin/ash
#
# this script assume you used ifconfig into /etc/rc.net
#
#set -x
# read configuration file
. /etc/modem.line
n=0
echo `date +%T` - Dialing ...
chat -v -b $SPEED -f bbs.scr < /dev/$TTY > /dev/$TTY 2> /tmp/chat.log
echo `date +%T` - Checking log file ...
n=`grep -c ailed /tmp/chat.log`
if [ $n = 0 ]
then
   echo `date +%T` - Login to ISP succesfull, starting PPP driver ...
#  this line is with debugging
#   ppp.drv  -b $SPEED -v -d  /dev/$TTY 2> /tmp/ppp.log &
#  this line is without debugging
   ppp.drv  -b $SPEED  /dev/$TTY  &
   echo `date +%T` - Login ended.
else
   echo `date +%T` - Failed to login to ISP.
fi
