Run hardcopy on a specific screen window

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?

McB

Posted 2013-07-22T17:59:22.223

Reputation: 221

Answers

2

The solution was the -p options.

screen -r hub -p 0 -X hardcopy 

This allows me to send to the screen I want. Also figured out Ctrl-a d to go back to shell without making a new screen, which helps.

McB

Posted 2013-07-22T17:59:22.223

Reputation: 221