使用Paramiko SSH exec_command压缩文件时如何获取进度更新

问题描述

我正在使用paramiko连接到Linux服务器。我打算将30gig文件压缩。我可以压缩它,但是要花很多时间,我想实时查看压缩的进度。如何使用paramiko实现这一目标?

cmd="""cd /myapp/data/oradata
rar a xxx.rar xxx.dmp 
    """

def sshcon(cmd):
    try:
        files=''
        client=paramiko.SSHClient()
        client.load_system_host_keys()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        client.connect(hostname,port=port,username=username,password=password)     
        stdin,stdout,stderr = client.exec_command(cmd)
        files=str(stdout.read().decode()).split('\n')
        client.close()
        return files
    except Exception as e:
        print(str(e))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)