python远程部署神器Fabric

# demo.py
from fabric import Connection
# 连接服务器,创建一个服务器连接实例对象
c = Connection("[email protected]", connect_kwargs={"password": "a"})

# 使用这个 对象,执行命令即可。
with c.cd('/root'):
    c.run("mkdir sun")
    c.run("ls")

猜你喜欢

转载自blog.csdn.net/sunt2018/article/details/90718269