0
I'm trying to run screen to connect to a serial port. I want it to run a command, and then every 60 seconds I want to use hardcopy to write which is shown to a log file.
So far I've done this:
screen -S hub /dev/ttyUSB0 115200
That opens up the connection I want. I then simply run
logs 2
Which gets the machine to output a status to the screen every 2 seconds, it just spits out a bunch of text.
I've managed to run:
screen -S hub -X hardcopy
a couple of time, but sometimes I end up with multiple screens (not even sure why) and if I do ^A ", I get a list of 2-3 windows. The fist is ttyUSB0 and then there are usually 1 or 2 bash windows.
How can I get it to run the hardcopy command on ttyUSB0 (window 0, I believe) automatically?