apache 不支持 chkconfig 解决方法

来源:互联网 发布:2016网络知识竞赛平台 编辑:程序博客网 时间:2024/05/16 05:59

将apache添加为开机启动有两个方法:

1、在/etc/rc.d/rc.local内加入启动命令 /usr/local/apache2/bin/apachectl  start

2、将http添加为系统服务 

cp /usr/local/apache2/bin/apachectl  /etc/rc.d/init.d/httpd

chmod +x  /etc/rc.d/init.d/httpd

[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig --list|grep httpd
httpd           0:关闭 1:关闭  2:关闭 3:关闭  4:关闭  5:关闭  6:关闭

[root@localhost ~]# chkconfig --level 345 httpd on
[root@localhost ~]# chkconfig --list|grep httpd

httpd           0:关闭  1:关闭 2:关闭 3:启用 4:启用 5:启用  6:关闭

如果出现[root@localhost ~]# chkconfig --add httpd
               httpd 服务不支持 chkconfig

解决过程如下:

编辑/etc/rc.d/init.d/httpd

#!/bin/bash
#chkconfig:345 61 61   //此行的345参数表示,在哪些运行级别启动,启动序号(S61);关闭序号(K61)

#description:Apache httpd   //此行必写,描述服务.

添加红色部分就可以拉!

再[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig --list|grep httpd
httpd           0:关闭 1:关闭  2:关闭 3:关闭  4:关闭  5:关闭  6:关闭

[root@localhost ~]# chkconfig --level 345 httpd on
[root@localhost ~]# chkconfig --list|grep httpd
httpd           0:关闭  1:关闭 2:关闭 3:启用 4:启用 5:启用  6:关闭

1 0
原创粉丝点击