V
V
Vlad Zaitsev2013-02-10 02:37:49
linux
Vlad Zaitsev, 2013-02-10 02:37:49

Kick SSH periodically

A script like this is running on the computer:

while true
do ssh [email protected]***.** -R 8080:localhost:80 -o ServerAliveInterval=100
done

Which is used only for port forwarding from the local machine to an external server. But here's the problem, for some reason the ssh session periodically falls off and hangs in this state for an indefinite time. You send a symbol - it immediately falls off with a broken pipe, and reconnects. And if you do not send, it can hang in an inactive state for an hour. How would you fix it?

On an external server in the config
TCPKeepAlive yes
ClientAliveInterval 10
ClientAliveCountMax 5


Can he just send a character in a cycle by a script? In this case, there are no problems, but I do not know how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2013-02-10
@vvzvlad

How would you fix it?

man autossh
Forwards an additional channel, sends "pings" over it and restores the connection itself if it breaks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question