FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


os:info: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
os:info:index.html [2017/11/27 23:07]
kurihara
— (current)
Line 1: Line 1:
-[[:index.html#OS Management|Top#OS Management]] 
-====== Check OS Information ====== 
  
-===== Operation ===== 
-<sxh bash toolbar:false gutter:false> 
- 
-</sxh> 
- 
-\\ 
-===== checkosinfo.py ===== 
-<sxh bash toolbar:false gutter:false> 
-import sys 
-from fabric.api import * 
-from fabric.contrib import files 
-from datetime import datetime 
- 
-FHHOME=os.environ["FHHOME"] 
- 
-#------------------------------------------------------------------ 
-#systeminfo 
-#------------------------------------------------------------------ 
-@task 
-def systeminfo(): 
-    hostname = run("hostname") 
-    date = datetime.now().strftime('%Y%m%d_%H%M') 
-    yearmonth = datetime.now().strftime('%Y%m') 
-    outfile = systeminfo.%s.%s"  % (hostname date) 
- 
-    local("test -d output/%s || mkdir output/%s"    % (yearmonth yearmonth)) 
-    run("test -d tools || mkdir tools") 
- 
-    put("%s/scripts/systeminfo.sh", "scripts/systeminfo.sh, mode=0755 % FHHOME) 
-    sudo("tools/systeminfo.sh 1>output/%s  2>/dev/null"   % (outfile)) 
-    get("output/%s", "output/%s/%s"  % (outfile yearmonth outfile)) 
- 
- 
-#------------------------------------------------------------------ 
-# check_reboot 
-#------------------------------------------------------------------ 
-@task 
-def check_reboot(): 
-    date = datetime.now().strftime('%Y%m%d_%H%M') 
-    outfile = check_reboot.%s"  % (date) 
- 
-    run("test -d tools || mkdir tools") 
-    put("%s/scripts/check_reboot.sh", "scripts/check_reboot.sh, mode=0755 % FHHOME) 
-    sudo("tools/check_reboot.sh 1>output/%s  2>/dev/null"   % (outfile)) 
- 
- 
-#------------------------------------------------------------------ 
-# check_reboot_diff 
-#------------------------------------------------------------------ 
-@task 
-def check_reboot_diff(): 
-    file1=run("ls -tr1 output/check_reboot.2* |tail -n 2 |head -n 1") 
-    file2=run("ls -tr1 output/check_reboot.2* |tail -n 1") 
-    run("sdiff -s -w 200 %s %s" % (file1 file2) 
-</sxh> 
- 
- 
-\\ 
-===== Scripts ===== 
- 
-|<100% 200px ->| 
-| [[os:scripts:systeminfo.sh.html]]       | 
-| [[os:scripts:check_reboot.sh.html]]     | 
-| [[scripts:check_ping_gw.sh.html]]  |   | 
- 
- 
-\\ 
-<WRAP box 90%> 
-[[:index.html#OS Management|Top#OS Management]] 
-<catlist -noAddPageButton -noHead -sortAscending> 
-</WRAP> 
- 
-\\ 
-\\ 
-[[:index.html#OS Management|Top#OS Management]] 


os/info/index.html.1511791622.txt.gz · Last modified: 2017/11/27 23:07 by kurihara