Pipe an infinite stream to internal loop?

Posted by Sh3ljohn on Ask Ubuntu See other posts from Ask Ubuntu or by Sh3ljohn
Published on 2013-06-28T09:06:18Z Indexed on 2013/06/28 10:29 UTC
Read the original article Hit count: 199

Filed under:
|
|

I've seen a lot of things about redirecting stdout to a TCP socket, but no real example of how to do it in practice, specifically when the output stream generated by the first "command" never ends.

To talk about something concrete, let's take programs like servers that typically output their log endlessly to stdout (well, as long as they run). If you redirect the output to a log file on the disk, then this file is always open (therefore not readable by others?) and grows infinitely, which eventually is going to cause problems.

This might be a nood question, but I don't know what it does or how to do it so.

  1. How to redirect the output of a command to the internal loop?
  2. I want to make sure that data is sent EVERY time something is written to stdout, and that the pipe won't wait for the command to end (never happens ideally!). Is that right?
  3. If 2 is true, is there a buffer system to send chunks of data once it reaches a certain size only?
  4. Could you give me concrete command line examples to do the above?

Thanks in advance

© Ask Ubuntu or respective owner

Related posts about redirect

Related posts about pipe