编译安装的httpd实现服务脚本,通过service和chkconfig进行管理
2024-08-27 04:18:44
把编译安装的httpd 实现服务脚本,通过service和chkconfig 进行管理
1 编译安装httpd
把httpd编译安装在/app/httpd/目录下。
2 在/etc/rc.d/init.d/目录下新建一个文件httpd
这个文件的目的在于让service 命令可以管理编译安装的httpd服务。
文件内容如下:
[root@CentOS68 ~]# cat /etc/rc.d/init.d/httpd #!/bin/bash
#
# httpd Start up the httpd server daemon
#
# chkconfig: 2345 99 01
# description: httpd is a protocol for web server.
# This service starts up the httpd server daemon.
#
# processname: httpd
case $1 in
start)
/app/httpd/bin/apachectl start ;;
stop)
/app/httpd/bin/apachectl stop ;;
status)
/app/httpd/bin/apachectl status ;;
*)
echo err
esac
3 添加为开机启动
[root@CentOS68 /app/httpd/bin]# chkconfig --add httpd
[root@CentOS68 /app/httpd/bin]# chkconfig --list |grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
可以看到已经添加成功
4 通过service 命令启动服务
[root@CentOS68 ~]# service httpd start
httpd: Could not reliably determine the server's fully qualified domain name, using CentOS68.localhost for ServerName
可以看到会报错,但是服务已经启动成功了,修改/app/httpd/conf/httpd.conf这个文件,把98行前面的#去掉即可
98 #ServerName www.example.com:80
现在可以通过service命令管理手动安装的httpd 服务了
最新文章
- 沃罗诺伊图(Voronoi Diagram,也称作Dirichlet tessellation,狄利克雷镶嵌)
- ✡ leetcode 163. Missing Ranges 找出缺失范围 --------- java
- VS2010 项目引用了DLL文件,也写了Using,但是编译时提示:未能找到类型或命名空间名称 <;转>;
- HTML5格式化
- Python核心编程笔记----注释
- P2P系统,一致性哈希和DHT
- Python_跟随目标主机IP变换
- 末学者笔记--shell编程上 2 玄
- Application Security Per-Engagement
- 仿QQ菜单栏:消息,电话菜单
- 永久关闭selinux
- Code Review(转)
- RabbitMQ生产者消费者
- 广播小案例-监听系统网络状态 --Android开发
- java中 this 关键字的三种用法
- WebDriver高级应用实例(7)
- Visual Studio 2010详细安装过程
- 项目冲刺Second
- 每日英语:How Pop Culture Influences Chinese Travelers
- 【转】HTML <;!--...-->; 注释 、CSS/JS //注释 和 /*.....*/ 注释
热门文章
- GWAS: 网页版的基因型填充(genotype imputation)
- spring 使用@AspectJ注解开发Spring AOP
- 如何发布自定义的UI 组件库到 npmjs.com 并且编写 UI组件说明文档
- C# 获取或设置指定 config 文件的值
- SQL Server数据同步到Oracle
- 【Tools】PDF编辑软件-pdfelement 6.8 官网文件中文+破解版本
- k8s SLUB: Unable to allocate memory on node -1 错误
- 记录一下vue slot
- extract()函数:用于从一个date或者interval类型中截取到特定的部分
- Appium移动自动化测试-----(五)python-client安装与测试