3 ms·
mkdir foo bar sshfs foo.server:foo.dir/ foo/ sshfs bar.server:bar.dir/ bar/ tail -F foo/foo.log bar/bar.log A method that doesn't involve sshfs: serve
by jolmg 5y ago
mkdir foo bar
sshfs foo.server:foo.dir/ foo/
sshfs bar.server:bar.dir/ bar/
tail -F foo/foo.log bar/bar.log
A method that doesn't involve sshfs:
servers=(foo bar)
pipes=("${servers[@]/%/.pipe}")
mkfifo "${pipes[@]}"
tail -F "${pipes[@]}" &
for p in "${pipes[@]}"; do
true > "$p"
done
for s in "${servers[@]}"; do
ssh "$s" tail -F file.log > "${s/%/.pipe}" &
done
%tail
There's timing issues on this alternative. I just ran each statement separately in a prompt, and luckily it worked. The first `true` statement needs to run after `tail` has started trying to read the first argument, and once that dies, the second run of `true` needs to run after `tail` starts reading the second argument. Last time I did something like this, I just typed the statements without the loops and ran by hand.
- dmurray 5y agoWow, I never used sshfs but this seems like a fantastic convenience.