0

One of my applications (Let's say "A") pushes its some alerts into STDIN and that app's shell script reads that STDIN and processes it. In the same way, there can be another applications (called B, C, D) which may pushes its outputs to the STDIN.

I want to know that can my first application may read the other applications' STDIN pushes and a conflict can occur in data ? (when I read STDIN of A, can there be contents of B , C STDIN ?)

closed as unclear what you're asking by Michael Homer, Tomasz, Sparhawk, Kusalananda, Dmitry Grigoryev Feb 21 '18 at 8:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

There is no useful "STDIN of A" in this scenario. The STDIN is always that of your application. a, b and c write to their STDOUT, the parentheses put them together, and the pipe connects the result to yourapp's STDIN. Where, yes, all those STDOUTs might conflict (one after the other, not intertwined).

( a ; b; c ) | yourapp

or

( a && b && c ) | yourapp

It is unclear whether you have a, b, and c inside a shell script ("that app's shell script") and whether it is the same script for all. If it is not, then the scripts are your "apps" and you are in the scenario above. If it is, you must have something like

while ...; do
    read something
    a
    b
    c
done

In the above scenario, the "read" will read the common STDIN of the outer application, again in order, possibly blocking if there is nothing to read, but I don't see how A can push anything in there.

I can't be sure, but I suspect this might a case where named pipes or message brokers might come in handy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.