-1

here's the scenario: you ssh into a remote linux host, leave the terminal idle for a while and come back to find the connection has dropped.

You've read the suggestions about setting keep-alive on the connection, and tried it, and it still fails.

You maybe even know about screen and/or tmux but still would rather not have to reconnect so often.

Is there any way of accomplishing this?

nzc
  • 1,576
  • 1
  • 14
  • 24
  • could you explain why you gave this a minus 1 vote? I'd like to avoid making the same mistake again. – nzc Oct 29 '19 at 15:07

1 Answers1

0

Here are two workarounds which may be acceptable/helpful to some:

  1. run emacs with the time display in the mode line. You can run this in place of screen/tmux and use the built-in terminal mode which is surprisingly functional, and your connections will not drop
  2. use something like the following when you leave your terminal

    alias keep_alive='while true; do ( sleep 60 ; date ) ; done'
    keep_alive
    

    then ctrl-c when you come back. It sleeps nearly all the time and in my experience printing the date every sixty seconds prevents the connection from timing out.

nzc
  • 1,576
  • 1
  • 14
  • 24