Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm monitoring two measurement devices (usbserial1 and usbserial2) over RS232 (via an USB adapter). I do this in the following way:

  1. I open two terminal windows.
  2. In one window I write the following commands:

    mkdir one
    cd one
    screen -L /dev/tty.usbserial1 9600

  3. In the other window I write:

    mkdir two
    cd two
    screen -L /dev/tty.usbserial2 115200

Now I want to send the date command to both the screen sessions at the same time. How do I do that?
This answer describes how I would do it for one session, but I want to do it for two sessions simultaneously.

share|improve this question
What do you mean “simultaneously”? By which I mean, why not do it for one session, and then, 5 milliseconds later, do it for the other session? – Scott Mar 5 '13 at 2:27
@Scott I want to do it simultaneously as this would synchronise the measurement devices. If I can do this with a fixed delay (e.g. 5 ms) this would also work for me, as I can later offset one datastream by the delay and still have synchronised data. How would I do this with a delay? – Saaru Lindestøkke Mar 5 '13 at 7:59
I was just thinking of a single command line that would {send to screen 1} ; {send to screen 2}. Now that I think about it (after a few hours of sleep), {send to screen 1} & {send to screen 2} would come even closer to simultaneity. And another thought: if fine-grained calibration is important, you could use strace (with the -tt option, or equivalent) on both commands to see exactly when they ran, and compute the offset. – Scott Mar 5 '13 at 15:29
Thank you for thinking about this problem. Could you please elaborate on your proposed solution? I am not very experienced with Terminal. – Saaru Lindestøkke Mar 5 '13 at 15:40
I’m not experienced with Terminal or Screen either. I was hoping that you had that part covered by that other question that you referenced; I was just addressing the Unix aspects. – Scott Mar 5 '13 at 16:42

You must log in to answer this question.

Browse other questions tagged .