startntripclient.sh 747 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. #
  3. # $Id$
  4. # Purpose: Start ntripclient
  5. # change these 3 according to your needs
  6. Stream='FFMT0'
  7. User='user'
  8. Password='password'
  9. DateStart=`date -u '+%s'`
  10. SleepMin=10 # Wait min sec for next reconnect try
  11. SleepMax=10000 # Wait max sec for next reconnect try
  12. (while true; do
  13. ./ntripclient -s www.euref-ip.net -r 80 -d $Stream -u $User -p $Password
  14. if test $? -eq 0; then DateStart=`date -u '+%s'`; fi
  15. DateCurrent=`date -u '+%s'`
  16. SleepTime=`echo $DateStart $DateCurrent | awk '{printf("%d",($2-$1)*0.02)}'`
  17. if test $SleepTime -lt $SleepMin; then SleepTime=$SleepMin; fi
  18. if test $SleepTime -gt $SleepMax; then SleepTime=$SleepMax; fi
  19. # Sleep 2 percent of outage time before next reconnect try
  20. sleep $SleepTime
  21. done)