2
2
I have been using the following command to connect to a server, which connects to another server and runs tail -f on it:
ssh server1.com ssh server2.com tail -f file.log
This so far works fine. However, when I want to quit the tail process by pressing ctrl+c, I do not quit the tail process, but the ssh process. This leaves the tail process on the remote server running, which obviosly is not a very good idea.
Does any one have an idea how I could fix this command line? I also would be interested if there is tool, running on os x, that would allow to comfortably switch between viewing different files on the remote server.
Couldn't you use tmux or screen on the remote servers? That's what I've always done. – Rob – 2011-11-30T14:10:51.760
See this Q&A : To get it working in command line or in the shell, the ssh agent shall be forwarded too, eg using the ssh option "A" (see ssh man page), like :
ssh -A user_foo@serverB "my_cmd"