【发布时间】:2015-03-07 15:37:18
【问题描述】:
是否可以流式传输正在通过 ssh 执行的程序的输出?
示例程序(远程test.py):
import time
while True:
print time.time()
time.sleep(1)
命令(本地):
ssh name@remote 'python test.py'
由于程序永远不会终止,因此输出不会流式传输;这在某种程度上可能吗?
【问题讨论】:
是否可以流式传输正在通过 ssh 执行的程序的输出?
示例程序(远程test.py):
import time
while True:
print time.time()
time.sleep(1)
命令(本地):
ssh name@remote 'python test.py'
由于程序永远不会终止,因此输出不会流式传输;这在某种程度上可能吗?
【问题讨论】:
显然,在 ssh 命令中添加 -t 选项是可行的。它刷新标准输出:
ssh -t name@remote 'python test.py'
【讨论】: