新版本的php-fpm没有了start stop这样的命令!最近用源码新装的LNMP环境为了管理方便 仿nginx写了一个启动脚本!水平有限 欢迎指点。
#!/bin/sh
#Description:php-fpm – this script starts and stop the php-fpm daemon
#
#chkconfig: 2345 86 16
#processname php-fpm
#config: /usr/local/php5.3.8/etc/php-fpm.conf
#pidfile: /usr/local/php5.3.8/var/run/php-fpm.pid
#Source function libary
. /etc/rc.d/init.d/functions
#Source networking configuration
. /etc/sysconfig/network
#Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
phpfpm="/usr/local/php5.3.8/sbin/php-fpm"
prog=$(basename $phpfpm)
CONF_FILE="/usr/local/php5.3.8/etc/php-fpm.conf"
lockfile="/usr/local/php5.3.8//var/log/php-fpm.lock"
dstart() {
[ -x $phpfpm ] && [ -f $CONF_FILE ]
echo -n "Starting $prog" || exit 6
daemon $phpfpm -y $CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] || touch $lockfile
return $retval
}
dstop() {
echo -n "Stopping $prog"
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -rf $lockfile
return $retval
}
configtest() {
$phpfpm -y $CONF_FILE -t
}
dreload() {
echo -n "Reloading $prog"
killproc $phpfpm -HUP
echo
}
dstatus() {
status $prog
}
case "$1" in
start)
dstart && exit 0
;;
stop)
dstop && exit 0
;;
restart)
dstop
sleep 1
dstart
;;
reload)
dreload || exit 7
;;
configtest)
configtest
;;
status)
dstatus
;;
*)
echo "Usage: $0 {start|stop|restart|reload|configtest|status}"
exit 2
;;
esac
把php-fpm放在/etc/init.d/下 运行以下命令 增加开机启动
chkconfig –add php-fpm
chkconfig php-fpm on
共同学习,写下你的评论
评论加载中...
作者其他优质文章