57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
start()
|
|
{
|
|
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()
|
|
{
|
|
while [ 1 ]; do
|
|
echo "* Stopping process..."
|
|
killall rtkrcv > /dev/null 2>&1
|
|
|
|
|
|
for r in 0 1 2 3 4 5 6 7 8 9; do
|
|
if [ -n "$(pidof rtkrcv)" ]; then
|
|
echo "* Waiting for process to exit ($r)..."
|
|
sleep 1
|
|
else
|
|
echo "* Process not running."
|
|
return 1
|
|
fi
|
|
done
|
|
|
|
echo "* Forcing exit..."
|
|
killall -9 rtkrcv > /dev/null 2>&1
|
|
sleep 1
|
|
done
|
|
}
|