#!/bin/bash
# Run ppp daemon, with user-specified parameters. Daemon is run in 
# a loop, so that if connection is dropped, we attempt reconnection
# automatically.

# Use RF1 port
port=/dev/ttySX12

baud=19200

# NOTE: /etc/hosts must be setup accordingly
from=mooring
to=shore

delay=3

hndshk=""

while :
do
  echo Setting up the ppp link from $from to $to at ${baud} baud on $port
  date
  /usr/sbin/pppd nodeflate nobsdcomp novj novjccomp -detach noauth lock $hndshk $from:$to $port $baud
  echo "**** PPP FAILED at `date`"
  sleep $delay
done
 
