您的位置:首页 > 运维架构 > Apache

Centos上将编译的apache加人系统服务

2017-08-18 10:30 302 查看
通过编译安装的apache无法直接使用service和systemctl来控制开关的。需要用chkconfig来加载为服务才可以。

用cp /opt/httpd/bin/apachectl /etc/rc.d/init.d/httpd   #将apachectl复制一份到init.d

vim /etc/rc.d/init.d/httpd

加上chkconfig的配置:

#!/bin/sh

#chkconfig: 2345 20 80

#description: Apache web server

#

主要是chkconfig: 2345 20 80     

2345是运行等级 20是启动优先级 80是关闭优先级,优先级越大就延迟动作

 运行#runlevel 可以查看当前的运行等级

The following runlevels are defined by default under Red Hat Enterprise Linux:

0
 — Halt

1
 — Single-user text mode

2
 — Not used (user-definable)

3
 — Full multi-user text mode

4
 — Not used (user-definable)

5
 — Full multi-user graphical mode (with an X-based login screen)

6
 — Reboot
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: