0

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.

Saaru Lindestøkke
  • 5,515
  • 8
  • 30
  • 48
  • 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 05 '13 at 02: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 05 '13 at 07: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 05 '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 05 '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](http://superuser.com/questions/116743/send-command-to-screen/150988#150988); I was just addressing the Unix aspects. – Scott - Слава Україні Mar 05 '13 at 16:42

0 Answers0