解决“service nginx does not support chkconfig”的问题?
来源:互联网 发布:沈阳兼职淘宝模特招聘 编辑:程序博客网 时间:2024/05/21 10:46
因为这2天要安装nginx服务器,其nginx没有提供启动脚本,就想自己写一个启动脚本,但是再写完脚本的时候,想使用service启动该服务,
nginx启动脚本如下:
#!/bin/bash
# Startup script for the nginx Web Server
# description: nginx is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
NGINX_HOME=/usr/local/nginx/sbin
NGINX_CONF=/usr/local/nginx/conf
PHP_HOME=/usr/local/php-fcgi/bin
if [ ! -f "$NGINX_HOME/nginx" ]
then
echo "nginxserver startup: cannot start"
exit
fi
case "$1" in
'start')
$PHP_HOME/spawn-fcgi -a 127.0.0.1 -p 10080 -C 20 -u nobody -f $PHP_HOME/php-cgi
$NGINX_HOME/nginx -c $NGINX_CONF/nginx.conf
echo "nginx start successful"
;;
'stop')
killall -TERM php-cgi
killall -TERM nginx
;;
esac
[root@node1 ~]# chkconfig --add nginx
service nginx does not support chkconfig
很是奇怪,后经过查找资料,发现如果想添加脚本用service启动,必须要脚本里面包含这2行:
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
其他的都不所谓,只是个注意而已!!!
修改后的nginx启动脚本:
#!/bin/bash
# Startup script for the nginx Web Server
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
NGINX_HOME=/usr/local/nginx/sbin
NGINX_CONF=/usr/local/nginx/conf
PHP_HOME=/usr/local/php-fcgi/bin
if [ ! -f "$NGINX_HOME/nginx" ]
then
echo "nginxserver startup: cannot start"
exit
fi
case "$1" in
'start')
$PHP_HOME/spawn-fcgi -a 127.0.0.1 -p 10080 -C 20 -u nobody -f $PHP_HOME/php-cgi
$NGINX_HOME/nginx -c $NGINX_CONF/nginx.conf
echo "nginx start successful"
;;
'stop')
killall -TERM php-cgi
killall -TERM nginx
;;
esac
[root@node1 ~]# chkconfig --add nginx
ok ,没有错误提示,说明添加成功!启动下看看,
[root@node1 ~]# service nginx stop
/sbin/service: line 68: 18616 Terminated env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
[root@node1 ~]# service nginx start
spawn-fcgi.c.190: child spawned successfully: PID: 18624
nginx start successful
大功告成!
nginx启动脚本如下:
#!/bin/bash
# Startup script for the nginx Web Server
# description: nginx is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
NGINX_HOME=/usr/local/nginx/sbin
NGINX_CONF=/usr/local/nginx/conf
PHP_HOME=/usr/local/php-fcgi/bin
if [ ! -f "$NGINX_HOME/nginx" ]
then
echo "nginxserver startup: cannot start"
exit
fi
case "$1" in
'start')
$PHP_HOME/spawn-fcgi -a 127.0.0.1 -p 10080 -C 20 -u nobody -f $PHP_HOME/php-cgi
$NGINX_HOME/nginx -c $NGINX_CONF/nginx.conf
echo "nginx start successful"
;;
'stop')
killall -TERM php-cgi
killall -TERM nginx
;;
esac
[root@node1 ~]# chkconfig --add nginx
service nginx does not support chkconfig
很是奇怪,后经过查找资料,发现如果想添加脚本用service启动,必须要脚本里面包含这2行:
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
其他的都不所谓,只是个注意而已!!!
修改后的nginx启动脚本:
#!/bin/bash
# Startup script for the nginx Web Server
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
NGINX_HOME=/usr/local/nginx/sbin
NGINX_CONF=/usr/local/nginx/conf
PHP_HOME=/usr/local/php-fcgi/bin
if [ ! -f "$NGINX_HOME/nginx" ]
then
echo "nginxserver startup: cannot start"
exit
fi
case "$1" in
'start')
$PHP_HOME/spawn-fcgi -a 127.0.0.1 -p 10080 -C 20 -u nobody -f $PHP_HOME/php-cgi
$NGINX_HOME/nginx -c $NGINX_CONF/nginx.conf
echo "nginx start successful"
;;
'stop')
killall -TERM php-cgi
killall -TERM nginx
;;
esac
[root@node1 ~]# chkconfig --add nginx
ok ,没有错误提示,说明添加成功!启动下看看,
[root@node1 ~]# service nginx stop
/sbin/service: line 68: 18616 Terminated env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
[root@node1 ~]# service nginx start
spawn-fcgi.c.190: child spawned successfully: PID: 18624
nginx start successful
大功告成!
1 0
- 解决“service nginx does not support chkconfig”的问题?
- service httpd does not support chkconfig的问题
- service httpd does not support chkconfig的问题
- service ***** does not support chkconfig
- service redis does not support chkconfig的解决办法
- service redis does not support chkconfig的解决办法
- Service redis does not support chkconfig的解决办法
- service tomcat does not support chkconfig 的解决办法:
- “service httpd does not support chkconfig” 問題
- service XXX does not support chkconfig
- service httpd does not support chkconfig
- service X does not support chkconfig
- service XXX does not support chkconfig
- service XXX does not support chkconfig
- service httpd does not support chkconfig linux
- service xxxx does not support chkconfig
- service xxx does not support chkconfig
- service activemq does not support chkconfig
- hive reduce 个数
- 新人报道
- Linux c目录操作函数scandir
- <a>控制<iframe>中显示网页
- jQuery Attr
- 解决“service nginx does not support chkconfig”的问题?
- 关于unity3d的ios帧频问题.
- 陶哲轩的时间管理
- 3DRT 骷髅带动画低模
- IOS:基于GET和POST方法的国内手机号码归属地查询系统
- oracle ALTER TABLE MOVE 索引失效
- 项目中及Linq 学习过程中知识点
- 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法
- CSharp学习笔记之十 类的修饰符