【问题标题】:Streaming output of a remotely executed program via ssh通过 ssh 流式传输远程执行程序的输出
【发布时间】: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'

由于程序永远不会终止,因此输出不会流式传输;这在某种程度上可能吗?

【问题讨论】:

    标签: python ssh


    【解决方案1】:

    显然,在 ssh 命令中添加 -t 选项是可行的。它刷新标准输出:

    ssh -t name@remote 'python test.py'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      • 2012-03-30
      • 1970-01-01
      • 2011-05-09
      • 1970-01-01
      相关资源
      最近更新 更多