Open Selective031 opened 5 years ago
This must be a side affect of the commit I made on 11/23/18 which fixes the autostart when the rtkrcv console is open. I will look into this for my next release. In the meantime the code should work as before if you remove the 11/23/18 commit.
Thanks, I will remove the commit and see what happens.
Same problem. I've restored lines
if (start) {
startsvr(NULL);
}
And it is working now. Emlid's fork has a bit different, may be it is better:
/* start rtk server */
if (start) {
if (startsvr(NULL) == 0)
intflg = 1;
}
I concur, restoring the lines makes it work as expected again.
Thanks,
If I open RTKRCV console on tcp port, rtkrcv will start after I connect to the console, but not start when rtkrcv run. Is this an expected behavior?
I run rtkrcv on linux on raspberry pi, compile with gcc and default makefile.
I read the code. Are you willing to change this behavior? Maybe I can help.
If I open RTKRCV console on tcp port, rtkrcv will start after I connect to the console, but not start when rtkrcv run. Is this an expected behavior?
I run rtkrcv on linux on raspberry pi, compile with gcc and default makefile.
I read the code. Are you willing to change this behavior? Maybe I can help.
I made this python script as a workaround, just put it in rc.local file so it runs at startup:
import socket import time
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect(('localhost', 5000)) client_socket.settimeout(10)
client_socket.send("admin" + '\r\n') time.sleep(1) client_socket.send("mypassword" + '\r\n') time.sleep(1) client_socket.close()
@Selective031 thanks.
Currently I fix it with echo exit | nc -Ct localhost 5000
after start rtkrcv process.
However I do not like this behavior, so I want to change it.
This is still an issue. It's due to the fact that autostart is handled at creation of the first "console", should it be local or telnet. Since the local console is deactivated when using telnet, the first console is created when a telnet connection occurs and the "autostart" is handled at this time.
In my opinion you shouldn't deactivate locale console when using telnet. I like to have a local console on the machine dedicated to a service and be able to connect to it remotely when I need to. Using a flag or option to deactivate local console would be a better implementation to let people choose the behaviour they prefer for rtkrcv .
So the easy workaround for this issue is to activate the local console at all time. It's a pretty easy fix, you just need to remove the "else" condition around the block labelled /* open device for local console */
in the main() function.
RobinDumeige@e2e02d8
however, it will cause error when run without terminal, like cron or systemd.
Well you can override the local console device with my fix using the -d option of rtkrcv. I've tried to set it to /dev/null with this command (works in a systemd service too, you just need to update the path to rtkrcv) :
./rtkrcv -p 12345 -s -d /dev/null
I don't have a receiver or proper data to actually "run" rtkrcv since i'm confined at home, but when activating the debug trace I see that the autostart seems to be working without connecting with telnet.
Could you try it and tell me if it's working on your end ?
there's nothing crazy in the systemd service unit file I used to test this, but just in case here is the content of it :
[Unit]
Description=RTKLIB (rtkrcv) Daemon
#Wait until networks is up
After=network-online.target
[Service]
# just launching the binary in background
Type=simple
# user running the process
User=myuser
Group=mygroup
# path to binary
ExecStart=/home/myuser/code/RTKLIB_Demo5/app/rtkrcv/gcc/rtkrcv -p 12345 -s -d /dev/null
# Restart automatically in case of error or processus killed/absent
Restart=always
#syslog info
SyslogIdentifier=rtkrcv
SyslogFacility=local7
StandardOutput=syslog
[Install]
WantedBy=multi-user.target
thanks.
the -d /dev/null
does work.
Thanks for letting me know it's working ! I'll make a merge request later today.
Hi,
I upgraded to the latest demo5 b31 and autostart is not working anymore. To make it start you need to telnet into the admin console, then a message comes up that the rtk service is starting.
This is my start command in /etc/rc.local on my Raspberry Pi: sudo /home/pi/RTKLIB/RTKLIB/app/rtkrcv/gcc/rtkrcv -o /home/pi/rtk.conf -s -p 5001 &
This worked perfectly in the b29 version.