I am connecting to a server using pysftp. Sending commands using the .execute functionality works just fine. Example of what works:
SftpConn.execute('cd ' + RemotePath + ';gzgrep -l ' + eventid + ' ' + ModuleId + '*')
But now I have a shell script I want to execute, which will prompt me for a username and a password. I can't seem to pass that information.
conn = pysftp.Connection(host=server, username=user, password=pw, cnopts=cnopts)
conn.put(localpath, remotepath)
print('0')
conn.execute('sh /home/tools/testtool')
time.sleep(.5)
print('1')
conn.execute(user2)
time.sleep(.5)
print('2')
conn.execute(pw2)
This prints 0 and then it's stuck. I think it's because the conn.execute('sh /home/tools/testtool') command is waiting for a return value that's never going to come. Any ideas how to get this going? Can I make it time out, or better yet, send a command without wanting a return value?