Table of Contents

Top#Middleware Management

Postfix (postfix.py)

$FHHOME/fabfile/postfix.py


Postfix Operation with Fabric

$ fab -l |grep postfix

$ fab  -H auht.pro  postfix.yum_install


Fabric Temporary Run Call Examples

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

$ fab  -H $H   -- "ps aux |grep postfix"

$ fab  -H $H   -- sudo systemctl status postfix
$ fab  -H $H   -- sudo systemctl restart postfix

$ fab  -H $H   -- postconf    # list all configuration
$ fab  -H $H   -- postconf -n    # Display only parameters different from default
$ fab  -H $H   -- postconf -d    # list default configuraiton


$ fab  -H $H   -- "ls /var/spool/mqueue |wc -l"    # List Queue
$ fab  -H $H   -- "mailq  |wc -l"   # List Queue
$ fab  -H $H   -- "postqueue -p |wc -l"
$ fab  -H $H   -- postcat -q QUEUE_ID    # show Postfix queue file contents


postfix.py

$FHHOME/fabfile/postfix.py

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


#----------------------------------------------------------------------
# Queue
#----------------------------------------------------------------------
# postfix.check_queue_num
@task
def postfix.check_queue_num():
    """ls /var/spool/mqueue | wc -l"""
    #sudo("mailq")
    sudo("ls /var/spool/mqueue | wc -l")



Postfix Configuration Examples




middleware



Top#Middleware Management