print "Trying to connect VM "
try:
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('hostname',username='abc',password='1234')
print ("Connected \n")
command1='cd '+ PATH + " ; ls -ltr %s/abc.bin | awk '{print $9}' | cut -d '/' -f 8 | xargs grid -h " + MACHINE_TYPE + " -f "
stdin, stdout, stderr = ssh.exec_command(command1)
for line in stdout:
print line
except paramiko.AuthenticationException:
print ("failed to connect \n")
sys.exit(1)
ssh.close()
这里stdout是一个巨大的输出,它将连续打印约600行。直到ssh.exec_command(command1)
为止,这将无法打印stdout。我也在控制台上寻找同步输出...任何帮助都会很棒!