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:get:index.html [2018/01/11 00:08] kurihara |
os:linux:get:index.html [2019/02/11 00:40] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
[[: | [[: | ||
- | ====== Get OS Conf (get.py) ====== | + | ====== Get Linux Configuration with Fabirc |
$FHHOME/ | $FHHOME/ | ||
Line 7: | Line 7: | ||
\\ | \\ | ||
- | ===== Operation ===== | + | ===== Operation |
<sxh bash toolbar: | <sxh bash toolbar: | ||
$ fab -l |grep get | $ fab -l |grep get | ||
- | $ fab -H $H auth.pro | + | $ fab -H $H |
</ | </ | ||
+ | |||
+ | |||
+ | |||
\\ | \\ | ||
Line 24: | 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=os.environ[" | ||
Line 32: | Line 36: | ||
# | # | ||
@task | @task | ||
- | def get.file_remote_local(remote, | + | def file_remote_local(remote, |
""" | """ | ||
date = datetime.now().strftime(' | date = datetime.now().strftime(' | ||
hostname = run(" | hostname = run(" | ||
- | outfile = %s/ | + | outfile = "%s/ |
- | get(" | + | |
+ | sudo(" | ||
+ | get("/tmp/%s, %s" % (date, outfile)) | ||
local(" | local(" | ||
- | + | run(" | |
# | # | ||
# get.sdiff_remote_local | # get.sdiff_remote_local | ||
Line 46: | Line 53: | ||
@task | @task | ||
def sdiff_remote_local(remote, | def sdiff_remote_local(remote, | ||
- | """ | + | """ |
date = datetime.now().strftime(' | date = datetime.now().strftime(' | ||
hostname = run(" | hostname = run(" | ||
- | outfile = %s/ | + | outfile = "%s/ |
- | get(" | + | |
+ | sudo(" | ||
+ | get("/tmp/%s, %s" % (date, outfile)) | ||
local(" | local(" | ||
- | | + | |
+ | run("rm -f /tmp/%s" % date) | ||
+ | local(" | ||
Line 63: | Line 74: | ||
date = datetime.now().strftime(' | date = datetime.now().strftime(' | ||
yearmonth = datetime.now().strftime(' | yearmonth = datetime.now().strftime(' | ||
- | outfile = systeminfo.%s.%s" | + | outfile = "systeminfo.%s.%s" |
- | local(" | + | local(" |
run(" | run(" | ||
+ | run(" | ||
- | put(" | + | put(" |
- | sudo(" | + | sudo(" |
- | get(" | + | get(" |
</ | </ | ||
Line 78: | Line 90: | ||
|<100% 200px ->| | |<100% 200px ->| | ||
- | | [[os: | + | | [[os:linux: |
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.