Git Product home page Git Product logo

fabric_docs_zh's Introduction

Fabric 中文文档(对应v1.10版本)

Fabric 是一个 Python(2.5-2.7)库以及命令行工具用于流式使用 SSH 来部署应用程序或者系统管理任务。

它提供了一个基础的套件用于执行本地或者远程 shell 命令(正常执行或者通过 sudo 执行),上传/下载文件,也有类似于提示运行中用户输入的辅助功能或中止执行。

通常用于调用创造的一个包含一个或多个功能的 Python 模块,然后通过 fab 命令行工具执行它们。下面是一个小而完整的包含一个任务的 "fabfile" 文件:

from fabric.api import run

def host_type():
    run('uname -s')

当一个任务被定义后,它可以运行在一台或多台服务器上,就像这样:

$ fab -H localhost,linuxbox host_type
[localhost] run: uname -s
[localhost] out: Darwin
[linuxbox] run: uname -s
[linuxbox] out: Linux

Done.
Disconnecting from localhost... done.
Disconnecting from linuxbox... done.

除了通过 fab 工具使用,Fabric 的组件也可以被导入到其他 Python 代码中,提供一个相对于 Paramiko 库(Fabric 自身使用的)更高层级上的 SSH 协议的 Pythonic 的接口。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.