Skip to content Skip to sidebar Skip to footer

How To Use Paramiko To Execute Remote Commands

I wanted to compress a folder on a remote namchine.For that i am using paramiko. But i don't know how to do that using paramiko. Any suggestions?? This is my code: dpath = '/var/my

Solution 1:

After

channel.exec_command(...)

You have to wait the termination of the command with:

while not channel.exit_status_ready()
    ... wait ... ( you can read the output with channel.recv, or sleep a bit)

Furthermore, you're zip command is weird... don't you want to say

zip -r /var/db/mysql.zip /var/db/mysql

Post a Comment for "How To Use Paramiko To Execute Remote Commands"