On different Linux boxes, I see different behavior with respect to SSH sessions hanging on exit when there are background jobs running.
If I do exactly the same thing
$ for f in 1 2 3 4 5; do echo $f >> output; sleep 5; done &
One will hang until the whole command is finished - which I expect - and the other will exit immediately but leave the command running.
I am aware of how to prevent the session from hanging (
screen or redirecting console input/output to or from /dev/null) - what I want to understand is why one of my servers is NOT hanging like I expected.
Was there a version of OpenSSH where the behavior changed? The one that hangs is OpenSSH 3.9p1, the one that doesn't hang is OpenSSH 4.3p2.
Both are using bash as default login shell, and I confirmed
huponexit option is off in both cases.