开发者

How to send three pipes of data over ssh?

I have a bash script on a remote host that produces a large amount of data on fd开发者_如何转开发=3 as well as some possibly interesting data on stdout and stderr. I want to:

  1. Log stdout and stderr to a file on my local machine.
  2. Write the data on fd=3 to stdout on my local machine.

Here's how it could be done if my big script were local:


exec 3> >(cat)
./big_script.sh -o /dev/fd/3 2>&1 >big_script.log
exec 3>&-

However, I want to run big_script.sh on a remote machine and have all three pipes (fd=1, fd=2, and fd=3) come out of the ssh program as separate. What is the best way to that?


nc (netcat) and tunnels ? you can make kinda log radio on your net this way!


SSH opens just a single tty, so you just get a single stream that has all the data. You cannot tell apart what went to what the other side seen as stdout and stderr.


You could log to files on the remote host, and then ssh remote tail -f each of the log files from your local machine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜