1

My Script

from __future__ import print_function
import paramiko

ip=''
port=22
username=''
password=''

cmd='./fioautomation.sh'
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip,port,username,password)

stdin,stdout,stderr=ssh.exec_command(cmd)

for line in iter(lambda:stdout.readline(1024)," "):
    print(line, end=" ")

Expectation: To read the output of the script, "automation.sh" simulatenously instead of waiting until the script completes execution to get the output in host machine.

Issue: I can only get the result after the automation.sh script is completed

Note: There is a FIO script inside the "automation.sh" which makes the script run for a quite long time. So I would like to kill the FIO script after a certain time period of running.

It would be helpful if someone helps me with this.

Thanks

Victor
  • 29
  • 2
  • Can you share FIO script's output? Does script output contain bulk single line or multiple lines? When i try your code, it runs correctly the way you wanted with python 2.7 – Kadir May 10 '17 at 14:14

0 Answers0