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
Next revision Both sides next revision
os:linux:get:index.html [2018/01/27 22:45]
kurihara
os:linux:get:index.html [2018/03/14 00:32]
kurihara
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 15: Line 15:
 </sxh> </sxh>
  
-==== Ref. Remote Shell Commands ==== 
-<sxh bash toolbar:false gutter:false> 
- 
-</sxh> 
  
  
Line 31: 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 39: Line 36:
 #------------------------------------------------------------------ #------------------------------------------------------------------
 @task @task
-def get.file_remote_local(remote,local):+def file_remote_local(remote,local):
     """get.file_remote_local:/etc/hosts,hosts"""     """get.file_remote_local:/etc/hosts,hosts"""
     date = datetime.now().strftime('%Y%m%d_%H%M')     date = datetime.now().strftime('%Y%m%d_%H%M')
Line 62: 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 82: Line 79:
     run("test -d scripts || mkdir scripts")     run("test -d scripts || mkdir scripts")
    
-    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", "output/%s/%s"  % (outfile, yearmonth, outfile))
Line 92: Line 89:
  
 |<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