zoukankan      html  css  js  c++  java
  • 编译安装的httpd实现服务脚本,通过service和chkconfig进行管理

    把编译安装的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 服务了

  • 相关阅读:
    Merge Sorted Array
    Remove Duplicates from Sorted List
    Climbing Stairs
    Plus One
    微信开发 (四) 微信网页授权
    基于注解的实现获取微信openId1
    利用TortoiseGit(小乌龟)将项目上传至GitHub网站
    微信网页授权多次回调code请求
    安装git之后,桌面出现蓝色问号的解决方法
    两个日期之间的日历
  • 原文地址:https://www.cnblogs.com/Sunzz/p/7132137.html
Copyright © 2011-2022 走看看