Created
October 18, 2014 06:23
-
-
Save shuxiang/9cdfb4ef56f0682a467c to your computer and use it in GitHub Desktop.
fabric test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf8 | |
from fabric.api import * | |
env.user = 'root' | |
env.password = 'jindengtaia10' | |
env.hosts = ['121.199.4.240'] | |
@task | |
def nginx_start(): | |
''' nginx start ''' | |
sudo('/etc/init.d/nginx start') | |
@task | |
def nginx_stop(): | |
''' nginx stop ''' | |
sudo('/etc/init.d/nginx stop') | |
@task | |
def test_ls(): | |
sudo('ls -a') | |
""" | |
$ fab --list -- 查看可用命令 | |
Available commands: | |
nginx_start nginx start | |
nginx_stop nginx stop | |
$ fab -H x.x.x.x nginx_start -- 启动 nginx | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
plaintext password