zoukankan      html  css  js  c++  java
  • rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local/etc/rc.d文件目录详解

    控制脚本目录/etc/rc.d,该目录下存在各个运行级别的脚本文件,以下是centos7为例的查询结果:

    [root@hostname centos7 root]# cd /etc/rc.d/
    [root@hostname centos7 rc.d]# ls
    init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local
    [root@hostname centos7 rc.d]# cd rc4.d/
    [root@hostname centos7 rc4.d]# ls
    K50netconsole S10network S64mysqld
    [root@hostname centos7 rc4.d]# 
    [root@hostname centos7 rc4.d]# 
    [root@hostname centos7 rc4.d]# 
    [root@hostname centos7 rc4.d]# cd /etc/rc.d/
    [root@hostname centos7 rc.d]# ls
    init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local
    [root@hostname centos7 rc.d]# cd rc0.d/
    [root@hostname centos7 rc0.d]# ls
    K36mysqld K50netconsole K90network
    [root@hostname centos7 rc0.d]# cd ../init.d/
    [root@hostname centos7 init.d]# ls
    functions mysqld netconsole network README

    说明:

    /etc/rc.d/init.d

    该文件夹包含所有服务在各个运行等级中的全部启动脚本。一般来说,它们都是标准的shell脚本,遵守最基本的标准。每个脚本最少接受两个参数start和stop,它们分别代表启动和停止服务(如网页服务)。除此之外,init脚本通常还会接受一些额外的选项,如restart(重启服务器)、status(返回服务当前状态)、reload(告知服务从配置文件中重新载入配置)以及force-reload(强制服务重载它的配置)。当用不带参数的方式运行脚本的时候,一般应该返回一个它会接受的参数列表。

    /etc/rc.d/rc0.d~/etc/rc.d/rc6.d

    这些文件夹分别包含每个运行等级对应的init脚本。在实际使用中,它们一般通过符号链接到/etc/init.d文件夹下的实际文件。不过要注意的是,这些文件夹下的init脚本都有一些特别的名字,命名都以S(start)、K(kill)或D(disable)开头,后面跟一个数字。当init进入一个运行等级的时候,它会按照数字顺序运行所有以K开头的脚本并传入stop参数,除非对应的init脚本在前一个运行等级中没有启动。然后init按照数字顺序运行所有以S开头的脚本并传入start参数。任何以D开头的init脚本都会被忽略—这让你可以在指定的运行等级禁止一个脚本,或者你也可以仅仅移除全部符号链接。所以如果你有两个脚本,S01foo和S05bar,init首先会运行S01foo start,当它进入特定的运行等级后再执行S05bar start。

    /etc/rc.d/rc.local

    并非所有的发行版都使用了rc.local,通常它是一个留给用户修改的shell脚本。一般会在init进程结束的时候运行它,所以你可以在这里放一些想要运行的额外脚本,而不用再创建自己的init脚本。

    /etc/rc.d/rc.sysinit

    /etc/rc.d/rc.sysinit主要做在各个运行模式中相同的初始化工作,包括设定PATH、设定网络配置(/etc/sysconfig/network)、启动swap分区、设定/proc等等。

    /etc/rc.d/rc

    当运行级别改变时,负责启动/停止各种服务。

  • 相关阅读:
    node中fs模块
    node生成excel,动态替换表格内容
    Postgresql存放数组形式的数据
    ubuntu下安装typescript
    随笔6
    excel文件导出相应数据统计内容
    随笔4
    随笔3.2
    随笔2
    随笔1
  • 原文地址:https://www.cnblogs.com/yyxianren/p/12395649.html
Copyright © 2011-2022 走看看