为了php-fpm管理方便,从php安装目录拷贝了启动脚本,更改相应路径,然后执行添加启动服务,出现如下错误。
service php-fpm does not support chkconfig
经过多方查找,原来是启动脚本中缺少了下面两行内容:
# chkconfig: 2345 15 95
# description: PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation \
# with some additional features useful for sites of any size, especially busier sites.
其中2345是默认启动级别,级别有0-6共7个级别。
等级0表示:表示关机
等级1表示:单用户模式
等级2表示:无网络连接的多用户命令行模式
等级3表示:有网络连接的多用户命令行模式
等级4表示:不可用
等级5表示:带图形界面的多用户模式
等级6表示:重新启动
15是启动优先级,95是停止优先级,优先级范围是0-100,数字越大,优先级越低。
启动脚本如下:
#!/bin/bash
# chkconfig: 2345 15 95
# description: PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation \
# with some additional features useful for sites of any size, especially busier sites.
# processname: php-fpm
# config: /usr/local/php/etc/php.ini
# Source function library.
. /etc/rc.d/init.d/functions
PHP_PATH=/server/php
DESC="php-fpm daemon"
NAME=php-fpm
DAEMON=$PHP_PATH/sbin/$NAME
CONFIGFILE=$PHP_PATH/etc/php-fpm.conf
PIDFILE=$PHP_PATH/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
rh_start() {
$DAEMON -y $CONFIGFILE || echo -n " already running"
}
rh_stop() {
kill -QUIT `cat $PIDFILE` || echo -n " not running"
}
rh_reload() {
kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
rh_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
rh_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
rh_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
rh_stop
sleep 1
rh_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。