zoukankan      html  css  js  c++  java
  • postfix启动脚本

    使用该脚本是一定要注意postfix安装路径

    #!/bin/bash
    #
    # postfix    Postfix Mail Transger Agent
    #
    # chkconfig: 2345 80 30
    # description: Postfix is a Mail Transport Agent, which is the program that moves mail from one machine to another
    # processname: master
    # pidfile /var/spool/postfix/pid/master.pid
    # config: /etc/postfix/main.cf
    # config: /etc/postfix/master.cf
    
    # Source function library.
    source /etc/rc.d/init.d/functions
    
    # Source networking configuation.
    source /etc/sysconfig/network
    
    # Check that networking is up.
    [ $NETWORKING = "no" ] && exit 3
    
    [ -x /usr/sbin/postfix ] || exit 4
    [ -d /etc/postfix ] || exit 5
    [ -d /var/spool/postfix ] || exit 6
    
    RETVAL=0
    prog="postfix"
    
    start() {
        # Start daemons .
        echo -n $"Starting postfix: "
        /usr/bin/newaliases >/dev/null 2>&1
        /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start"
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix
        echo
        return $RETVAL
    }
    
    stop() {
        # Stop daemons .
        echo -n $"Shutting down postfix: "
        /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop"
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix
        echo
        return $RETVAL
    }
    
    reload() {
        echo -n $"Reloading postfix: "
        /usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload"
        RETVAL=$?
        echo
        return $RETVAL
    }
    
    abort() {
        /usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort"
        return $?
    }
    
    flush() {
        /usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush"
            return $?
    }
    
    check() {
        /usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check"
            return $?
    }
    
    restart() {
        stop
        start
    }
    
    # See how we were called
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        restart)
            stop
            start
            ;;
        reload)
            reload
            ;;
        abort)
            abort
            ;;
        flush)
            flush
            ;;
        check)
            check
            ;;
        status)
            status master
            ;;
        condrestart)
            [ -f /var/lock/subsys/postfix ] && restart || :
            ;;
        *)
            echo $"Usage:$0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"
            exit 1
    esac
    
    exit $?
    #END

     赋予执行权限:

    # chmod 755 /etc/rc.d/init.d/postfix

    将postfix添加到服务列表

    chkconfig --add postfix

    设置开机自启动

    # chkconfig postfix on

  • 相关阅读:
    web前端优化之reflow(减少页面的回流)
    Javascript深拷贝
    MySQL 配置优化
    MySQ中Lmax_connections的合理设置
    Too many connections解决方案
    Linux 查看文件内容
    ON DUPLICATE KEY UPDATE
    jquery $.each 和for怎么跳出循环终止本次循环
    使用redis避免客户端频繁提交数据
    windows下为mysql添加日志
  • 原文地址:https://www.cnblogs.com/fansik/p/5683775.html
Copyright © 2011-2022 走看看