linux的启动原理
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-03-22
|
t time
#
# Taken in part from Miquel van Smoorenburg''s bcheckrc.
#
HOSTNAME=`/bin/hostname` //设置主机名
HOSTTYPE=`uname -m` //设置系统类型
unamer=`uname -r` //用unamer保存uname –r的结果
set -m
if [ -f /etc/sysconfig/network ]; then //初始化网络配置
. /etc/sysconfig/network
fi
if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then //设置主机名,如果没有,就以//calhost作为主机名
HOSTNAME=localhost
fi
if [ ! -e /proc/mounts ]; then //挂载系统文件
mount -n -t proc /proc /proc
mount -n -t sysfs /sys /sys >/dev/null 2>&1
--More—
接下来init进程会执行/etc/inittab脚本中的代码,这个脚本中定义了linux的运行级别.以及每个级别对应的引导步骤.
[root@Bruse ~]# cat /etc/inittab | more
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level. // init文件描述
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
# //作者说明
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this) //关闭系统
# 1 - Single user mode //单用户模式
# 2 - Multiuser, without NFS (The same as 3, if you do not have netwo***ng)
//多用户模式,没nfs
# 3 - Full multiuser mode //完全多用户模式
# 4 – unused //未使用
# 5 - X11 //图形环境
# 6 - reboot (Do NOT set initdefault to this) //重启系统
#
id:3:initdefault: //默认启动级别为3
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit //调用sysinit:/etc/rc.d/rc.sysinit脚本
l0:0:wait:/etc/rc.d/rc 0 //处于0级的操作
l1:1:wait:/etc/rc.d/rc 1 //处于1级的操作
l2:2:wait:/etc/rc.d/rc 2 //处于2级的操作
l3:3:wait:/etc/rc.d/rc 3 //处于3级的操作
l4:4:wait:/etc/rc.d/rc 4 //处于4级的操作
l5:5:wait:/etc/rc.d/rc 5 //处于5级的操作
l6:6:wait:/etc/rc.d/rc 6 //处于6级的操作
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now //允许使用CTRL-ALT-DELETE组合键
# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and wo***ng correctly.
pf::powerfail:/sbin/shutdown -f -h 2 "Power Failure; System Shutting Down"
// 当收到来自UPS的断电警告2分钟后关机
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdo |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn
为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!
|