Long-running ssh commands in python paramiko module (and how to end them)

后端 未结 6 1778
野性不改
野性不改 2020-11-30 02:39

I want to run a tail -f logfile command on a remote machine using python\'s paramiko module. I\'ve been attempting it so far in the following fashion:

6条回答
  •  余生分开走
    2020-11-30 03:01

    1) You can just close the client if you wish. The server on the other end will kill the tail process.

    2) If you need to do this in a non-blocking way, you will have to use the channel object directly. You can then watch for both stdout and stderr with channel.recv_ready() and channel.recv_stderr_ready(), or use select.select.

提交回复
热议问题