为什么 ssh + nohup 对网络相关进程不起作用?

Why does ssh + nohup not work with network-related processes?

我一直在尝试使用 ssh 通过网络触发一些安装脚本。最初这些脚本使用 git clone,但我一直收到错误代码 141(根据 git mailing list,这似乎是 SIGPIPE)。尝试用 wget 替换 git 显示相同的问题,即:

ssh user@server 'nohup wget http://google.ch &' // produce no result on the server
ssh user@server // then on the server
nohup wget http://google.ch & // works

已尝试使用不同的服务器 (debian/ubuntu/vm/native)。虽然以这种方式使用 apt 是可行的。 关于原因和建议的解决方案的任何想法?提前致谢。

对于那些处于类似情况的人,@shellter 的指针是一个很好的读物(谢谢!)。一种解决方案是使用 -t -t 作为 ssh 标志,并注意不要在命令中包含背景切换,即:

ssh -t -t user@server 'nohup command' > /dev/null 2>&1 &