I would like picocom to log serial data on a remote computer, without having to keep my ssh session to the remote computer alive.

I have tried:

picocom <my options>

This dies when I logout.

picocom <my options> & 

No output on terminal, and exiting picocom with C-a C-x leaves the job as stopped, it doesn't kill it (I need to kill -9, a simple kill on the job does not work. I then have to manually clean the tty lock in /var/lock/).

picocom <my options> > tmp/data.log&

then in another ssh session:

tail -f tmp/data.log

No data cames out in the file data.log.

bash -c "picocom --baud 115200 /dev/ttyACM1 > /home/pi/tmp/data.log" &

No output to the file either. The job becomes "Stopped" right away.

nohup sh -c "picocom --baud 115200 /dev/ttyACM1 > /home/pi/tmp/data.log" &

I get the start output of picocom in the tailed file, but then the job is exited.

Good to know as well: picocom does not react to C-z.

My questions are:

  • is it at all possible to run picocom in the background?
  • what alternatives are there to log serial terminal without an open session?

An alternative is to setup the device with stty, then read it with cat:

stty <my options>
nohup sh -c "cat /dev/ttyACM0 > data.log" &

Assuming the user session is meant, you might be able to use screen with the -X option to send commands to a running screen session and the stuff command to send keystrokes to the current window.

screen -dmS newScreen bash
screen -S newScreen -X stuff "picocom <options>\n"
screen -ls
screen -r <pid>

Please take note to put the quotes around and the next line in order for the commands to be executed. *

... haven't checked if bash -c or tmux would be possible too.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.