ntnu-b2xx: fs/etc/rc.d: rtklib services now checks the nest for cmd file type.

This commit is contained in:
Kristian Klausen 2016-03-05 13:35:11 +01:00
parent b1aedc92b4
commit fa6027292d
2 changed files with 45 additions and 2 deletions

View File

@ -1,6 +1,35 @@
start() start()
{ {
(cd /opt/lsts/rtklib/ && exec rtkrcv -s -o /etc/rtklib/conf/rtkrcv.conf -d /tmp/ttyC0 < /dev/null > /opt/lsts/rtklib/startlog.log 2>&1 &) localBackupPath="/opt/lsts/rtklib/rtklib_cmdfile.cmd"
cfgPath="/etc/rtklib/conf/rtkrcv.conf"
cfgPathUse="/opt/lsts/rtklib/conf_use.conf"
# First, try to get the configuration
cmdFile=`wget -q -O - 10.0.60.51:8080/rtklib_cmdfile.cmd`
res=$?
if [ $res -ne 0 ]; then
#echo "Could not find file. Trying to read backup."
if [ -f $localBackupPath ]; then
echo "Error connecting to server. Reading from backup path."
cmdFile=`cat ${localBackupPath}`
else
echo "Error connecting to server. No local backup file. Using default. "
cmdFile="GPS_5Hz.cmd"
fi
fi
echo "Using cmd file: ${cmdFile}"
#echo "Storing in last used file. "
echo ${cmdFile} > ${localBackupPath}
cfgFileContent=`cat ${cfgPath}`
cp ${cfgPath} ${cfgPathUse}
echo "file-cmdfile1 =/etc/rtklib/cmd/${cmdFile}" >> ${cfgPathUse}
(cd /opt/lsts/rtklib/ && exec rtkrcv -s -o ${cfgPathUse} -d /tmp/ttyC0 < /dev/null > /opt/lsts/rtklib/startlog.log 2>&1 &)
} }
stop() stop()

View File

@ -1,6 +1,20 @@
start() start()
{ {
str2str -in serial://uart/2:9600:8:n:1:off -c /etc/rtklib/data/ubx_raw_10hz.cmd -out tcpsvr://:50022 < /dev/null > /dev/null 2>&1 & cmdFilePath="/opt/lsts/dune/www/rtklib_cmdfile.cmd"
# Exists?
if [ ! -f ${cmdFilePath} ]; then
echo "No commandfile found. Creating default."
echo "GPS_5Hz.cmd" >> ${cmdFilePath}
fi
cmdFile=$(<${cmdFilePath})
cmdFile=`cat ${cmdFilePath}`
echo "Starting str2str server with command file: ${cmdFile}"
str2str -in serial://uart/2:115200:8:n:1:off -c /etc/rtklib/cmd/${cmdFile} -out tcpsvr://:50022 < /dev/null > /dev/null 2>&1 &
} }
stop() stop()