How to maintain a persistent SSH connection?
Phil Pennock
phil.pennock at globnix.org
Fri Nov 17 14:57:19 AEDT 2017
On 2017-11-15 at 22:44 +0100, martin f krafft wrote:
> First, we need to debate to death whether it should be
>
> while sleep 1; do echo .; done
>
> or
>
> while echo .; do sleep 1; done
>
> ;)
Hah. Clearly `while sleep N`, because that way killing the sleep
propagates the death out of the loop, making it easier to clean up
afterwards. My bikeshed should be blue.
I realized afterwards that really, this is too frequent and also that I
didn't think through what ssh's default buffering behavior might be
without a PTY.
The simplest fix is thus to just use `ssh -t` to get line-buffering and
have each echo try to pass content to the client.
Otherwise, >> dd if=/dev/zero bs=1500 count=1 << is likely to work, but
at the cost of a chunk of unnecessary traffic. Really, sacrifice a PTY
and let the systems all automatically decide to flush output on each
line.
-Phil
More information about the openssh-unix-dev
mailing list