I try to build a pipe chain over ssh.
mkfifo localpipe; and on a remote machine mkfifo remotepipe;
cat localpipe | ssh -q einstein "cat > remotepipe"
Using echo "input;" > localpipe I can send input to a program that reads from remotepipe. But after that the remotepipe, the localpipe and the ssh-connection will be closed.
Is there a way to keep localpipe and ssh open but to close remotepipe, which I need to in order to make the program on the remote side process its input?
If this doesn’t work with cat or some other unix command, could I write a short cat replacement in C in order to achieve this?
localpipe may also be closed but I want to keep ssh open for speed reasons.
First open a connection which opens a
ControlMaster, then multiplex your executions through the control socket it opens, as explained in this SO answer.