Linux Administration Handbook 笔记 startup script

1. Bootstrapping = Booting

Bootstrapping :starting up a computer

During bootstrapping, the kernel is loaded into memory and begins to execute。

step of booting:

1. loading and initialization kernel

Boot Room(BIOS)->MBR->Boot Loader(grub)->Kernel

2. Device detection and configuration

3. Creation of kernel threads

4. Operator intervetion (single-user mode)

通过grub传给内核single选项,内核通知 init 调用 sulogin,single-user mode 下面登入的是root

5. Execution of system startup scripts

init 运行 startup scripts

6. Multiuser operation

init 运行 getty 等待用户登录,如果是图形界面,还要执行xdm或者gdm


2. init 执行启动脚本,这些发生在登录界面出现之前

init 启动脚本通常叫做 “rc files”,rc 表示 "run command"。

这些脚本的任务有:

设置计算机名,设置时区;

调用fsck检查磁盘,挂载磁盘,清理/tmp;

配置网络接口;

启动daemons和网络服务;


3. run levels

init 定义了7个run levels:

level 0 is the level in which the system is completely shut down

level 1 or S represents single-user mode

level 2-5 are multiuser levels

level 6 is a "reboot" level


各个run level 要做的都定义在 /etc/inittab 中,其中可以定义系统默认的run level,不同的发行版本,它的格式有可能不同。

在切换 run level 的时候,init 会执行 /etc/init.d/rc,它会执行其他和run level 相关的目录中的脚本,使系统达到新的run level,之后会查看rc*.d(*表示新的run level号)

rc*.d中的包含的是符号链接 链接到/etc/init.d目录中的脚本,这些脚本都是以K或S,加上数字 开头,如下图。当系统run level 从低-->高转变时,运行以S开头的脚本,并且以数字升序执行,并传以start参数;当从高-->低转变时,运行K开头的脚本,并以数字降序执行,并传以stop参数。





 新的启动管理器:

上面的内容可能有地那过时,ubuntu 10.04之后使用upstart,redhat 也将要用init的替代者 systemd





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值