Any pexpect substitutes?

I am writing a script using python pexpect to execute another script on a remote computer. It works fine in normal cases, but if there is time.sleep in the remote script, it doesn't work.

I want to get to the remote computer by running the script in the background and exit. Is it possible?

Can someone suggest an alternative or let me know how to get around this problem?

+4
source share
1 answer

Did you consider paramiko ?

Here is an example ...

 #!/usr/bin/env python import paramiko ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.connect(hostname='example.com', port=22, username='sethu', password='****') ssh.exec_command('nohup sleep 300 &') ssh.close() 
+1
source

All Articles