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