#! /bin/csh -f

#
setenv PATH /sbin:/usr/sbin:$PATH
rehash

set start="`date`"
/usr/sbin/ppp-off
#
sleep 10
set count=0
#
echo "Started at: $start"
while (1)
   echo -n "."
   @ count++
   /usr/sbin/ppp-on
   sleep 5
   while ( `ps -ax | grep -v grep | grep -v zombie | grep -c 'pppd '` )
      # date
      sleep 5
      if (`netstat -rn | grep -c ppp0`) then
         /usr/sbin/location teuben@astro.umd.edu   &
         echo ""
         echo "This time it took $count attempts to dial in."
	 echo "Started at: $start"
	 echo "Done at:    `date`"
         echo "Now registering at DYN.ML.ORG:"
	 dyn  peter88 31 0 67 `myip` teuben
         exit 0
      endif
   end
end
