linux 关机前 关闭程序,Linux 启动/关机顺序

一篇比较旧的文章,但是说的还不错。关键还是找台linux机器,读读脚本就一切清楚了。

http://www.techrepublic.com/article/customizing-the-linux-bootup-and-shutdown-processes/1056248

个人总结 -

1.启动时,LILO解压、加载Linux内核,检查硬件,加载关键内核模块,mount根目录。

2.启动init进程,init进程启动时读取它的配置文件 - /etc/inittab,这个文件是对init进程的配置文件,它的配置一直关系到机器起来后init进程的行为,关系到整个系统运行阶段

2.1. init进程启动后,读取配置文件/etc/inittab,做如下几件事情(都在/etc/inittab里面指定):

2.1.1 id:5:initdefault:  (系统启动后处于Level 5)

2.1.2 init执行脚本 /etc/rc.d/rc.sysinit (si::sysinit:/etc/rc.d/rc.sysinit)。这个过程重点是系统内核级别的初始化,或者很基础的东西,如配置网络,文件系统,加载模块

2.1.3 init执行/etc/rc.d/rc脚本,参数是当前的Level 5 (l5:5:wait:/etc/rc.d/rc 5)

/etc/rc.d/rc脚本是关系到应用程序的,具体说是“服务”程序。

它启动/etc/rc.d/rc5.d/下所有S开头的脚本

Linux下所有的服务都是放在/etc/rc.d/init.d下,运行命令"service"时会那里找

在/etc/rc.d/rc脚本运行完所有服务后,有最后一个服务是rc.local,即最后运行/etc/rc.d/rc.local,可以把用户自定义的开机服务放到这里

Power on -> kernel unzip & load key modules & initialize hw & mount / -> start init process

As forinitprocess starting up:

init read/etc/inittab for configuration

run the default init (id:5:initdefault:) (note:only for system boot)

run basic initialization -/etc/rc.d/rc.sysinit(hostname, network, filesystem, kernel module loaded) (note: only for system boot)

run /etc/rc.d/rc script  to handle services, with the arg of Run Level

- Read /etc/rc.d/rcN.d/, stop services with K* (by checking /var/lock/subsys/*lock*)

- Read /etc/rc.d/rcN.d, start services with S* (by checking /var/lock/subsys/*lock*)

- the last service to start is /etc/rc.local (note: only for system boot)

Other config for the init processing during system run

Note: the above way applies to all the System Run Level once the init process has been configured.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值