Created
September 15, 2014 09:31
-
-
Save anonymous/c769233e723b6c2bdf82 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
from fabric.api import * | |
from fabric.contrib.console import confirm | |
import sys | |
import os | |
import subprocess | |
env.hosts = ['192.168.1.8'] | |
env.user = 'root' | |
env.password = 'a' | |
def host_type(): | |
run('hostname') | |
def mk_directory(): | |
""" | |
Make Directory into /tmp | |
""" | |
host_type() | |
result = run("ls -ld /tmp/abc") | |
if result.failed: | |
run("mkdir /tmp/abc") | |
if __name__ == '__main__': | |
if len(sys.argv) > 1: | |
subprocess.call(['fab', '-f', __file__] + sys.argv[1:]) | |
else: | |
subprocess.call(['fab', '-f', __file__, '--list']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment