优酷土豆挪动自动布置东西

auto_deploy
Server Auto Deploy Tool
设想头脑:

现在运用fabric保护服务器的同道应当许多,然则,在我四周的的工作环境中,大都是由运维同砚晋级和保护服务器, 而运用fabric有进修本钱,你不能强求人家用python,多半运维同砚照样忠于bash的, 于是乎,就有了写shell剧本,并在长途实行的需求,今后江湖就是一片血雨腥风。

github 地点:
https://github.com/edisonlz/auto_deploy

Usage:

usage: python deploy.py -c config.ini -e exc.ini -u ./package -p /root/downloads/dw

Config Server config.ini:

config use password

host,port,user,passwd
config use private key

tag(default:1),host,port,user,private_key(ssh rsa),encrypt type(rsa,dsa:lowercase)
e.g.

127.0.0.1 22 liuzheng bmc
127.0.0.1 22 liuzheng /Users/liuzheng/.ssh/id_dsa dsa
127.0.0.1 22 liuzheng /Users/liuzheng/.ssh/local_rsa rsa

Config Exceute Commend exc.ini:

ls -ls |head -n 10
grep a . |head -n 10
.....
Why can’t I run programs in the background with &? It makes paramiko hang.

Run the program under nohup and redirect stdin, stdout and stderr to /dev/null
 (or to your file of choice, if you need the output later):

run("nohup yes >& /dev/null < /dev/null &") (yes is simply an example of a program that may run for a long time or forever
; >&, < and & are Bash syntax for pipe redirection and backgrounding, 
respectively – see your shell’s man page for details.)

depend on

easy_install paramiko
    原文作者:edisonlz
    原文地址: https://segmentfault.com/a/1190000000344818
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞