Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to keep checking a log file(named myapp.log) located on a remote web server & keep the up-to-date content of this file showing to me (by using the linux command tail -f myapp.log). The name of the remote web server is service

This remote web server can only be accessed through other 2 remote servers (named Alpha & Beta). So, I have to establish several SSH connections in order to access the remote service server. like below:

Step 1, SSH to Alpha server:

ssh myname@alpha.server.org (password is required)

(Now, I'm on Alpha server)

Step 2, SSH to Beta server through Alpha:

ssh beta.server.org (password is required)

(Now, I am on Beta)

Step 3, SSH to service server through Beta:

sudo ssh service (password is required)

(Now, I am on Service server)

Step 4, open my server log file:

tail -f myapp.log

Every time, I have to execute the above commands on terminal in order to access myapp.log file. The most boring part is the connection only keep alive for 20min, then I have to run those commands again to access the myapp.log file.

Is there a way that I could keep the connections alive all the time, that I can see the myapp.log content all the time without making those SSH connections every 20min ?

I need this for both Mac machine & Windows 7 machine. Any suggestions?

share|improve this question

1 Answer 1

It would help if you knew why the server drops your connection..

On Mac OSX, you can set the timeout for Terminal.app in /.ssh/config put:

ServerAliveInterval 300
ServerAliveCountMax 3

In windows I assume you're using putty, under the Connection option, set the
Seconds between keepalives to a non 0 number.

The Mac option is for your user's personal connections, if you want to change the behavior for any user, set it in /etc/ssh/ssh_config

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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