Open dlech opened 8 years ago
Right now I am relying on this. E.g. if the program hangs, one can long press the back-button to kill it (and with that the service).
I would suggest using a dbus.service file to start the service instead the systemd.service file. This would actually solve several problems. You wouldn't have to manually enable/disable the openroberta systemd service (it's off by default because it uses lots of memory because it is python). Brickman can call auto start the dbus service by changing this line to AUTO
.
The dbus auto start sounds like a good idea, but IMHO that would not solve the autostart issue in the case of a bad behaving service. ANd to be sure, we would completely drop the systemd service file in this case, right?
I took a look at what it would take to add a dbus service file , but I can find a decent spec (only files like: http://dbus.freedesktop.org/doc/system-activation.txt). I also did a bit of checking what kind of keys are in use:
$ cat /usr/share/dbus-1/system-services/*.service | grep "=" | cut -d'=' -f1 | sort -u
Exec
Name
SystemdService
User
and if you look at the current systemd service: https://github.com/OpenRoberta/robertalab-ev3dev/blob/develop/debian/openrobertalab.service we're missing a few things like:
For the tty setup we could reconsider my bricklaunch PR. And for the journal I can take a look at http://www.freedesktop.org/software/systemd/python-systemd/journal.html, but then I need to make sure everything works in python3 (python3-systemd).
I'll play around with this a bit next time I am working on brickman. I'm actually thinking about restoring the previous brickman behavior where it starts on the next available tty instead of the current tty. This way you can launch it from a remote terminal without the need for something like bricklaunch. Still not sure what the best way to go about that is though. So, let's just put this issue on hold for a while.
The programs send from the the roberta-lab will be run in-process of the service (to avoid the startup-latency). Hence the service need to already grab an tty when starting.
I tried running openrobertalab.service on my FatcatLab EVB just to see what happens. It crashes because of #8. But, because systemd service tell it to always restart (
Restart=always
), it creates an infinite loop of crashing. Fortunately, systemd is smart enough to see this and kill the loop eventually, but it left brickman thinking the service was still available because it restarted so many times so quickly.