简体   繁体   English

如何使用python脚本运行远程shell命令

[英]How to run remote shell command using python script

I tried to run remote command to back up my server db, after dumbing it I can't figure out how to remotely get the datas. 我试图运行远程命令来备份我的服务器数据库,但将其复制后我无法弄清楚如何远程获取数据。

https://docs.python.org/2/library/subprocess.html https://docs.python.org/2/library/subprocess.html

Found some documentation, but that didn't really helped me. 找到了一些文档,但这并没有真正帮助我。

Most databases have some remote-backup service available, so I'd look into that first. 大多数数据库都有一些可用的远程备份服务,因此我将首先进行研究。

That said, you could use a library that simplifies secure-shell operations. 也就是说,您可以使用简化安全外壳操作的库。 One of those is Fabric which was based on paramiko . 其中之一是Fabric这是基于的paramiko

Fabric was designed for things like remote backups (or deployments). Fabric是为诸如远程备份(或部署)之类的东西而设计的。 You want to look specifically at it's get operation capabilities. 您要专门查看它的get操作功能。

I advice you to read this documentation. 我建议您阅读本文档。

=> https://docs.python.org/2/library/ssl.html#socket-creation => https://docs.python.org/2/library/ssl.html#socket-creation

Best regards, 最好的祝福,

Greg 格雷格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM