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?

New contributor
Bil is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.


Your Answer

Bil is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.