• php-fpm之启动脚本


    #!/bin/bash -
    #
    #php-fpm - this script starts and stops the php-fpm daemin
    #########################################################
    #                                                       #
    # 85 15 代表S和K的默认排序号。启动序号(85);关闭序号15       #
    # 3代表运行级别,如果默认所有级别不启动,那就用"-"表示         #
    #                                                       #   
    #########################################################
    #chkconfig: 3 85 15
    #description: php-fpmd is PHPFastCGI manager,only for PHP
    #
    #processname:php-fpm
    #pidfile:  /usr/local/php/var/run/php-fpm.pid
    #logfile:  /usr/local/php/var/log/php-fpm.log
    
    #Source function library. ". /" - 运行文件
     . /etc/rc.d/init.d/functions
    
    #Source networking configuration.
     . /etc/sysconfig/network
    
    #Check that networking is up.
     [ "$NETWORKING" = "no" ] && exit 0
    
    phpfpm="/usr/local/php/sbin/php-fpm"
    prog=$(basename $phpfpm)
    
    
    lockfile=/var/lock/subsys/phpfpm
    
    start(){
        [ -x $phpfpm ] || exit 5
         echo -n $"Starting $prog: "
        daemon $phpfpm 
        retval=$?
        echo
        [ $retval -eq 0 ] && touch $lockfile
        return $retval
    }
    
    stop() {
        echo -n $"Stopping $prog: "
        killproc $prog -QUIT
        retval=$?
        echo
        [ $retval -eq 0 ] && rm -f $lockfile
        return $retval
    }
    
    restart() {
        stop
        start
    }
    
    reload() {
        configtest || return $?
        echo -n $"Reloading $prog: "
        killproc $phpfpm -HUP
        RETVAL=$?
        echo
    }
    
    force_reload() {
        restart
    }
    
    rh_status() {
        status $prog
    }
    
    rh_status_q() {
        rh_status >/dev/null 2>&1
    }
    
    case "$1" in
        start)
            rh_status_q && exit 0
            $1
            ;;
        stop)
            rh_status_q || exit 0
            $1
            ;;
        restart|configtest)
            $1
            ;;
        reload)
            rh_status_q || exit 7
            $1
            ;;
        force-reload)
            force_reload
            ;;
        status)
            rh_status
            ;;
        condrestart|try-restart)
            rh_status_q || exit 0
                ;;
        *)
            echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
            exit 2
    esac
  • 相关阅读:
    组合数学总结
    字符串算法总结
    数据结构总结
    CDQ分治(学习笔记)
    网络流(学习笔记)
    string
    water
    mine
    洛谷 P4035 【球形空间产生器】
    洛谷 P3306 【随机数生成器】
  • 原文地址:https://www.cnblogs.com/changbo/p/5021634.html
Copyright © 2020-2023  润新知