forked from ursereg/ntripserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntripserver.sh
23 lines (21 loc) · 873 Bytes
/
ntripserver.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
. /etc/default/ntripserver.conf
DateStart=`date -u '+%s'`
SLEEPMIN=10 # Wait min sec for next reconnect try
SLEEPMAX=10000 # Wait max sec for next reconnect try
while true;
do
# while true; do ./ntripserver -M 1 -i /dev/ttys0 -b 9600 -O 2 -a www.euref-ip.net -p 2101 -m Mount2 -n serverID -c serverPass; sleep 60; done
ntripserver -M 1 -O 3 -a $SERVER -p $PORT -m $MOUNTPOINT -n $USER -c $PASSWORD -i $DEVICE -b $BAUDRATE
if test $? -eq 0;
then
DateStart=`date -u '+%s'`; fi
DateCurrent=`date -u '+%s'`
SLEEPTIME=`echo $DateStart $DateCurrent | awk '{printf("%d",($2-$1)*0.02)}'`
if test $SLEEPTIME -lt $SLEEPMIN; then SLEEPTIME=$SLEEPMIN; fi
if test $SLEEPTIME -gt $SLEEPMAX; then SLEEPTIME=$SLEEPMAX; fi
# Sleep 2 percent of outage time before next reconnect try
echo "Retry after " + $SLEEPTIME
sleep $SLEEPTIME
done