FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

middleware:httpd:index.html



This is an old revision of the document!


Top#Middleware Management

Apache httpd (httpd.py)

Apache httpd Operation

$ fab -l |grep httpd

$ fab  -H $H auth.pro  httpd.install_yum

$ H=test-server-1,test-server-2

$ fab  -H $H auth.pro  -- "ps aux |grep postfix"
$ fab  -H $H auth.pro  -- "ps aux |grep apahce"

$ fab  -H $H auth.pro  -- tree -Dpuga  /etc/httpd
$ fab  -H $H auth.pro  -- tree -Dpuga  /etc/apache2


httpd.py

$FHHOME/fabfile/httpd.py

import sys
from fabric.api import *
from fabric.contrib import files
 
#----------------------------------------------------------------------
# Installing Apache httpd
#----------------------------------------------------------------------
# httpd.install_yum
@task
def install_yum():
    sudo("rpm -q httpd        > /dev/null 2>&1 || yum -y install httpd")

# httpd.install_apt
@task
def install_apt():
    sudo("dpkg -l |grep apache    > /dev/null 2>&1 || apt install apahce2")



#----------------------------------------------------------------------
# Check Files
#----------------------------------------------------------------------
#RHEL/CentOS
# httpd.check_files_etc_httpd
@task
def check_files_etc_httpd():
    '''tree -Dpuga  /etc/httpd #centos'''
    run("tree -Dpuga  /etc/httpd")

#Debian/Ubuntu
# httpd.check_files_etc_apache2
@task
def check_files_etc_apache2():
    '''tree -Dpuga  /etc/apache2  #ubuntu'''
    run("tree -Dpuga  /etc/apache2")


#----------------------------------------------------------------------
# Check Modules
#----------------------------------------------------------------------
#RHEL/CentOS
@task
def check_modules_pkg():
    '''/usr/sbin/httpd -M  # Package'''
    run("/usr/sbin/httpd -M")

@task
def check_modules_src():
    '''/usr/local/apache2/bin/httpd -M  # SRC'''
    run("/usr/local/apache2/bin/httpd -M")


#----------------------------------------------------------------------
# Check Server-Status
#----------------------------------------------------------------------
@task
def check_server-satus():
    '''curl http://localhost/server-status?auto'''
    run("curl  http://localhost/server-status?auto")


#----------------------------------------------------------------------
# Check Header
#----------------------------------------------------------------------
@task
def check_header():
    '''curl -I http://localhost/'''
    run("curl -I http://localhost/")



Apache httpd Configuration



middleware/httpd/index.html.1514821905.txt.gz ยท Last modified: 2018/01/02 00:51 by kurihara