将httpd/apache设为自启动 httpd 服务不支持 chkconfig

将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

chkconfig --add httpd

chkconfig --list|grep httpd

httpd 服务不支持 chkconfig
vi /etc/rc.d/init.d/httpd

添加

#!/bin/bash
#chkconfig:345 61 61   //此行的345参数表示,在哪些运行级别启动,启动序号(S61);关闭序号(K61)
#description:Apache httpd   //此行必写,描述服务.

Tags: Linux

添加新评论