I have a python script which reads incoming data from a physical serial port, does some processing and MQTT publishes it. It's deployed as a systemd service. Debugging information is just printed(). I don't want to spew all the debugging to a log file.
How do I simply read that serial output, some time after the service is already running? Normally, the serial output is just thrown away.
It should be something like:
python3 serialgateway.py > /dev/something 2>&1
in the systemd service. Every print() and error statement goes to /dev/something.
And then from a command line
cat /dev/something
to see what the script is doing. Is this a job for socat?