2

There's a service that pipes it's output to a named pipe, which I create with mkfifo name.

The service pauses if there's no reader in pipe. How to make it to keep piping the data even if there's no reader?

The reader(s) may (or may not) use the pipe later.

Edit: No buffer is needed. Readers will start reading from where they use the pipe. Data before that is lost. And that's OK. Consider it's a video stream.

2 Answers2

2
tail -F namedpipe

might be of interest to you in this case … It should keep the pipe open and writable for your service constantly.

You can as well, if you want, discard its output to minimize used resources by redirecting it to e.g. /dev/null like so:

tail -F namedpipe > /dev/null
Raffa
  • 34,963
0

Use socat to extract the data from the socket as soon as possible, put it into a file for example, and then read from it in another socat to another socket:

$ socat gopen:socket1 create:file1 
$ mkfifo socket2
$ socat gopen:file1 gopen:socket2

You might play with multiple socat options.