FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| 
                    os:linux:ope:index.html [2018/02/14 00:26] kurihara  | 
                
                    os:linux:ope:index.html [2019/02/11 00:41] (current) kurihara  | 
            ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| $ fab -l |grep ope. | $ fab -l |grep ope. | ||
| - | $ echo xx.xx.xx.xx | fab   | + | $ echo xx.xx.xx.xx | fab ope.check_user01 | 
| </ | </ | ||
| - | ==== Ref. Remote Shell Commands  | + | \\ | 
| + | ==== Fabric one-line Task Examples  | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ echo xx.xx.xx.xx | fab auth.pro  | + | $ echo xx.xx.xx.xx | fab -- hostname | 
| - | $ echo xx.xx.xx.xx | fab auth.pro  | + | $ echo xx.xx.xx.xx | fab -- sudo cat /etc/shadow | 
| </ | </ | ||
| Line 30: | Line 31: | ||
| from fabric.contrib import files | from fabric.contrib import files | ||
| from fabric.operations import open_shell | from fabric.operations import open_shell | ||
| + | from datetime import datetime | ||
| FHHOME=os.environ[" | FHHOME=os.environ[" | ||
| Line 35: | Line 37: | ||
| # | # | ||
| # ope.put | # ope.put | ||
| - | #      | + | #      | 
| # | # | ||
| @task | @task | ||
| def put(local, | def put(local, | ||
| - |     """ | + |     """ | 
|     put(" |     put(" | ||
| Line 45: | Line 47: | ||
| # | # | ||
| # ope.ssh | # ope.ssh | ||
| - | #      | + | #      | 
| # WARNING: This is too late for copy and past. So you use usually fhssh.sh | # WARNING: This is too late for copy and past. So you use usually fhssh.sh | ||
| # | # | ||
| @task | @task | ||
| def ssh(): | def ssh(): | ||
| - |     ''' | + |     ''' | 
|     open_shell(" |     open_shell(" | ||
| Line 56: | Line 58: | ||
| # | # | ||
| # ope.sshcmd | # ope.sshcmd | ||
| - | #      | + | #      | 
| # | # | ||
| @task | @task | ||
| def sshcmd(cmd): | def sshcmd(cmd): | ||
| - |     ''' | + |     ''' | 
|     open_shell(" |     open_shell(" | ||
| Line 66: | Line 68: | ||
| # | # | ||
| # ope.sudo_vi | # ope.sudo_vi | ||
| - | #     fab -H x.x.x.x  | + | #     fab -H x.x.x.x  | 
| # | # | ||
| # WARNING: open_shell didn't use 'echo x.x.x.x |fab ' and ' | # WARNING: open_shell didn't use 'echo x.x.x.x |fab ' and ' | ||
| Line 73: | Line 75: | ||
| @task | @task | ||
| def sudo_vi(file): | def sudo_vi(file): | ||
| - |     """ | + |     """ | 
| - |     open_shell(" | + |     open_shell(" | 
| Line 80: | Line 82: | ||
| # | # | ||
| # ope.cp_p_1dayago(file) | # ope.cp_p_1dayago(file) | ||
| - | #      | + | #      | 
| # | # | ||
| @task | @task | ||
| def cp_p_1dayago(file): | def cp_p_1dayago(file): | ||
| - |     """ | + |     """ | 
|     sudo(" |     sudo(" | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.