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/01/24 01:02] kurihara  | 
                
                    os:linux:ope:index.html [2019/02/11 00:41] (current) kurihara  | 
            ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| [[: | [[: | ||
| - | ======  | + | ======  | 
| $FHHOME/ | $FHHOME/ | ||
| Line 10: | Line 10: | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ echo xx.xx.xx.xx | fab auth.pro -- hostname | ||
| - | $ echo xx.xx.xx.xx | fab auth.pro -- sudo cat /etc/shadow | ||
| - | |||
| $ fab -l |grep ope. | $ fab -l |grep ope. | ||
| - | $ echo xx.xx.xx.xx | fab   | + | $ echo xx.xx.xx.xx | fab ope.check_user01 | 
| </ | </ | ||
| + | \\ | ||
| + | ==== Fabric one-line Task Examples ==== | ||
| + | <sxh bash toolbar: | ||
| + | $ echo xx.xx.xx.xx | fab -- hostname | ||
| + | $ echo xx.xx.xx.xx | fab -- sudo cat /etc/shadow | ||
| + | </ | ||
| \\ | \\ | ||
| Line 24: | Line 27: | ||
| <sxh python toolbar: | <sxh python toolbar: | ||
| - | import sys | + | import sys, os | 
| from fabric.api import * | from fabric.api import * | ||
| 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 33: | Line 37: | ||
| # | # | ||
| # ope.put | # ope.put | ||
| - | #      | + | #      | 
| # | # | ||
| @task | @task | ||
| def put(local, | def put(local, | ||
| - |     """ | + |     """ | 
|     put(" |     put(" | ||
| Line 43: | Line 47: | ||
| # | # | ||
| # ope.ssh | # ope.ssh | ||
| - | #      | + | #      | 
| + | # 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 53: | Line 58: | ||
| # | # | ||
| # ope.sshcmd | # ope.sshcmd | ||
| - | #      | + | #      | 
| # | # | ||
| @task | @task | ||
| def sshcmd(cmd): | def sshcmd(cmd): | ||
| - |     ''' | + |     ''' | 
|     open_shell(" |     open_shell(" | ||
| Line 63: | 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 70: | Line 75: | ||
| @task | @task | ||
| def sudo_vi(file): | def sudo_vi(file): | ||
| - |     """ | + |     """ | 
| - |     open_shell(" | + |     open_shell(" | 
| Line 77: | 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.