FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


os:linux:get:index.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
os:linux:get:index.html [2018/02/03 10:37]
kurihara
os:linux:get:index.html [2018/07/11 00:04]
kurihara [get.py]
Line 1: Line 1:
 [[:index.html#OS Management|Top#OS Management]] [[:index.html#OS Management|Top#OS Management]]
-====== Get OS Conf (get.py) ======+====== Get Linux Configuration with Fabirc (get.py) ======
  
 $FHHOME/fabfile/get.py $FHHOME/fabfile/get.py
Line 7: Line 7:
 \\ \\
  
-===== Operation =====+===== Operation with Fabric =====
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 27: Line 27:
 from fabric.api import * from fabric.api import *
 from fabric.contrib import files from fabric.contrib import files
 +from datetime import datetime
  
 FHHOME=os.environ["FHHOME"] FHHOME=os.environ["FHHOME"]
Line 58: Line 59:
          
     sudo("cp %s /tmp/%s" % (remote,date))     sudo("cp %s /tmp/%s" % (remote,date))
-    get("/tmp/%s, %s" % (date outfile))+    get("/tmp/%s, %s" % (dateoutfile))
     local("sdiff -s -w 150 %s %s" % (outfile, local))     local("sdiff -s -w 150 %s %s" % (outfile, local))
          
Line 75: Line 76:
     outfile = "systeminfo.%s.%s"  % (hostname, date)     outfile = "systeminfo.%s.%s"  % (hostname, date)
    
-    local("test -d output/%s || mkdir output/%s"    % (yearmonth, yearmonth))+    local("test -d %s/output/%s || mkdir %s/output/%s"  % (FHHOME, yearmonth, FHHOME, yearmonth))
     run("test -d scripts || mkdir scripts")     run("test -d scripts || mkdir scripts")
 +    run("test -d output || mkdir output")
    
-    put("%s/scripts/systeminfo.sh", "scripts/systeminfo.sh, mode=0755 % FHHOME+    put("%s/scripts/systeminfo.sh" % FHHOME, "scripts/systeminfo.sh", mode=0755) 
-    sudo("scripts/systeminfo.sh 1>output/%s  2>/dev/null"   % (outfile)) +    sudo("scripts/systeminfo.sh  1>output/%s  2>/dev/null"   % (outfile)) 
-    get("output/%s", "output/%s/%s"  % (outfile, yearmonth, outfile))+    get("output/%s", "%s/output/%s/%s"  % (outfile, FHHOME, yearmonth, outfile))
    
 </sxh> </sxh>
Line 88: Line 90:
  
 |<100% 200px ->| |<100% 200px ->|
-| [[os:get:scripts:systeminfo.sh.html]]       |+| [[os:linux:get:scripts:systeminfo.sh.html]]       |
  
  


os/linux/get/index.html.txt · Last modified: 2019/02/11 00:40 by kurihara