My problem is that file differs in size anywhere from 1000 lines to 10000 lines and the below method doesn't work as it copies only a few lines and closes
client = SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(drasclientip, username=def_users[i], key_filename=pem_file)
sftp = client.open_sftp()
time.sleep(10)
sftp.get(remote_file, file_dst,None)
time.sleep(20)
sftp.close()
client.close()
I am only interested in the remote serves file which has some text at the end of the file.
I am thinking 2 ways - either make the file transfer faster and efficient or read the remote file in reverse - that way I can get the end results at least
above code I put delays and it works something.
So here is what worked for me.
code:
*SSH client connect to remote server
ssh.exec("tac" + filename.txt + " >> filereversed.txt" )
*read the filereversed.txt from remote server and validate