【服务器部署工具】Python Deploy工具Fabric

【服务器部署工具】Python Deploy工具Fabric - Function - ITeye技术网站

在管理很多很多服务器的时候,有时会有这样的需求:

从本地向某些服务器上传、从server下载数据到本地、获取某个命令在某些server上的执行结果。Python的小工具fabric就是解决这样的需求。

 

 

 

sudo apt-get install python-dev(安装Python头文件)

 

python-setuptools (安装easy_install)

 

sudo apt-get install fabric

 

 

以下以几个例子说明。

Python代码   收藏代码
  1. # fabfile.py  
  2. def uptime():  
  3.     run('uptime')  
  4.   
  5. $Sgt; fab uptime -H 10.1.1.3  
  6. [10.1.1.3] run: uptime  
  7. [10.1.1.3] out:  05:20:39 up 88 days, 12:00,  0 users,  load average: 0.030.030.00  
# fabfile.py
def uptime():
    run('uptime')

$Sgt; fab uptime -H 10.1.1.3
[10.1.1.3] run: uptime
[10.1.1.3] out:  05:20:39 up 88 days, 12:00,  0 users,  load average: 0.03, 0.03, 0.00
 

 

 

fabric英音:['fæbrik]美音:['fæbrɪk]

名词 n. 

1.
织物 ,织品 ;布料 [C][U]
These clothes are made of imported fabrics
这些衣服用进口布料制成。
2.
构造 ,结构 ;组织 [U]
The whole social fabric was threatened with disintegration. 
整个社会结构有瓦解的危险。
3.
建筑 ;建筑物 ;构造物 [U]

 

posted on 2012-02-22 11:19  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2012/02/22/2362821.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值