Fabric 介绍

功能:
远端执行python函数
远端执行命令
传输文件
远端交互


--------------------------------------------------------------------------------

安装方式:
pip install Fabric

 


--------------------------------------------------------------------------------

入门:
第一步:编写命令在python文件fabfile.py 中,这样的好处对交互过程可控

from __future__ import with_statement
from fabric.api import local, settings, abort, run, cd
from fabric.contrib.console import confirm

def deploy():
code_dir = '/opt/lx'
with cd(code_dir):
run("ls -al")


第二步:执行
fab deploy

参考:http://docs.fabfile.org/en/1.6/tutorial.html

posted @ 2013-05-29 16:55  lxgeek  阅读(284)  评论(0编辑  收藏  举报