php-fpm service startup script

In php-fpm or when patching, php-fpm restart only need to execute php-fpm restart or reload, since php5.3, php-fpm start and stop seemed more trouble, specifically nginx rewrite a self-starting script, the following script phpfpm = "/ usr / local / php-5.3.10 / sbin / phpfpm" modify your phpfpm it. php-fpm since startup script
cat /etc/init.d/nginx
Follows
#!/bin/sh  
# DateTime: 2013-09-16
# Author: lianbaikai
# site:http://www.ttlsa.com/html/3039.html
# chkconfig:   - 84 16   
# 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-5.3.10/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() {  
    configtest || return $?  
    stop  
    start  
}  

reload() {  
    configtest || return $?  
    echo -n $"Reloading $prog: "  
    killproc ${phpfpm} -HUP  
    RETVAL=$?  
    echo  
}  

force_reload() {  
    restart  
}  

configtest() {  
  ${phpfpm} -t
}  

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  
        ;;  
    status)  
        rh_status  
        ;;  
    *)  
        echo $"Usage: $0 {start|stop|status|restart|reload|configtest}"  
        exit 2  
esac
Configure php-fpm Service
# php-fpm加入服务
chkconfig --add php-fpm
# php-fpm 234级别下设置为启动
chkconfig php-fpm on
# 查看php-fpm服务当前配置
chkconfig --list php-fpm
php-fpm         0:off   1:off   2:on    3:on    4:on    5:on    6:off
Use php-fpm
# 启动
service php-fpm start
# 关闭
service php-fpm stop
# 重启
service php-fpm restart
# 重载
service php-fpm reload
#检查配置文件
service php-fpm configtest
Start effect is as follows: [caption id = "attachment_3040" align = "alignnone" width = "614"] php-fpm service startup script [/ caption] script shows
# Source function library.  
. /etc/rc.d/init.d/functions  

# Source networking configuration.  
. /etc/sysconfig/network
More than the amount of lines of code in the end someone will question what they do, '' is similar to the program include source and require, all the way inside the functions poured into here, here you can use the program, for example here used daemon, status. The second line of the network actually a few lines, as follows
NETWORKING=yes
 HOSTNAME=E10162
The variable assignment as they determine whether to activate the card, if you do not go nginx card, in fact, this network can be removed tips:. Daemon is achieve a beautiful figure [OK] function please indicate the source:. Http: //www.ttlsa.com/html/3039.html

Reproduced in: https: //my.oschina.net/766/blog/211478

Guess you like

Origin blog.csdn.net/weixin_34026276/article/details/91493096