import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('hostname', username='test1234', password='test')
path = ['/home/test/', '/home/test1/','/home/test3/']
sftp = client.open_sftp()
check = 'tail -f /home/test/logs/check.out'
for filename in sftp.listdir(path):
if filename.endswith('.txt'):
h = path + filename
stdin,stdout,stderr = client.exec_command('%s && %s | grep -i "Connection time out"' %path %check)
stdout = = revout.read().decode().splitlines()
print stdout
i tried to pass 2 string at a time to exec_command. But it's not working. how to pass 2 string at a time?
str.format?