网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

php5.2+php5.4启动关闭脚本整合

php5.2 启动和关闭脚本直接copy /usr/local/php/sbin/php-fpm 到 /etc/init.d/目录下就行了

创新互联主要从事成都做网站、网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务路南,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220

php5.4 启动和关闭脚本直接copy  cp -f /tools/php-5.3.6/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 到 /etc/init.d/目录下就行了

将2者合并之后为:

#! /bin/sh

prefix=/usr/local/php

exec_prefix=${prefix}

php_fpm_CONF=${prefix}/etc/php-fpm.conf

phpver=$(${prefix}/bin/php -v|head -1|awk '{print $2}'|awk -F"." '{print $1"."$2}')

if [[ $phpver == '5.2' ]];then

php_fpm_PID=${prefix}/logs/php-fpm.pid

php_fpm_BIN=${prefix}/bin/php-cgi

php_opts="--fpm-config $php_fpm_CONF"

else

php_fpm_PID=${prefix}/var/run/php-fpm.pid

php_fpm_BIN=${exec_prefix}/sbin/php-fpm

php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"

fi

wait_for_pid () {

try=0

while test $try -lt 35 ; do

case "$1" in

'created')

if [ -f "$2" ] ; then

try=''

break

fi

;;

'removed')

if [ ! -f "$2" ] ; then

try=''

break

fi

;;

esac

echo -n .

try=`expr $try + 1`

sleep 1

done

}

case "$1" in

start)

echo -n "Starting php_fpm "

if [[ $phpver == '5.2' ]];then

$php_fpm_BIN --fpm $php_opts

else

$php_fpm_BIN --daemonize $php_opts

fi

if [ "$?" != 0 ] ; then

echo " failed"

exit 1

fi

wait_for_pid created $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

;;

stop)

if [[ $phpver == '5.2' ]];then

echo -n "Shutting down php_fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -TERM `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

else

echo -n "Gracefully shutting down php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -QUIT `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed. Use force-quit"

exit 1

else

echo " done"

fi

fi

;;

quit)

echo -n "Gracefully shutting down php_fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -QUIT `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

;;

force-quit)

echo -n "Terminating php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -TERM `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

;;

restart)

$0 stop

$0 start

;;

reload)

echo -n "Reload service php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -USR2 `cat $php_fpm_PID`

echo " done"

;;

logrotate)

echo -n "Re-opening php-fpm log file "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -USR1 `cat $php_fpm_PID`

echo " done"

;;

status)

if [ ! -r $php_fpm_PID ] ; then

echo "php-fpm is stopped"

exit 0

fi

PID=`cat $php_fpm_PID`

if ps -p $PID | grep -q $PID; then

echo "php-fpm (pid $PID) is running..."

else

echo "php-fpm dead but pid file exists"

fi

;;

*)

if [[ $phpver == '5.2' ]];then

echo "Usage: $0 {start|stop|quit|restart|reload|logrotate}"

exit 1

else

echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"

exit 1

fi

;;

esac



网站名称:php5.2+php5.4启动关闭脚本整合
新闻来源:http://bjjierui.cn/article/pdjpij.html

其他资讯