零零社区|百姓的网上家园-互动交流平台!(0.0)=^_^=(00社区)

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz

Solaris系统管理培训(第六章:启动过程)

2013-4-5 11:33| 发布者: 123456000000| 查看: 13| 评论: 0

摘要: 启动有四个阶段 BootPROM阶段 Bootprogram阶段 Kernel初始化阶段 /sbin/init阶段 启动过程: 自检、显示系统信息、读取启动设备的0扇区、在启动设备寻找启动程序、加载启动程序、启动内核、运行/sbin/init。 /sbin/i ...

 启动有四个阶段 
  Boot PROM 阶段 
  Boot program 阶段 
  Kernel 初始化阶段 
  /sbin/init 阶段 

启动过程: 
自检、显示系统信息、读取启动设备的0扇区、在启动设备寻找启动程序、加载启动程序、启动内核、运行/sbin/init。 
/sbin/init程序 
  读取/etc/inittab文件。Init程序执行/sbin/rc*脚本。 

系统有多种运行级别,不同的运行级别所启动的服务不同。 
系统运行级别有8种,分别为: 
运行级别 意义 
0 进入PROM状态(OK状态) 
1 管理状态(所有文件系统都挂上的单用户模式,禁止其他用户登录) 
2 多用户模式(没有网络文件共享服务) 
3 多用户模式(有网络文件共享服务) 
4 未使用 
5 退出操作系统并关机 
6 重新启动机器 
S,s 单用户模式 

who命令查看运行级别 
# who -r 
   .       run-level 3   5月 10 17:03     3      0  S 
可得到的信息:当前运行级别是3,系统启动的时间是5月10日17:03. 

/etc/inittabinittab定义了: 
系统缺省运行级别 
系统进入新运行级别需要做什么 

/etc/init.d目录包含了系统的一些启动脚本 
/etc/rc1.d目录包含进入运行级别1所需要运行的一些脚本 
/etc/rc2.d目录包含进入运行级别2所需要运行的一些脚本 
... 
... 

这些目录下包含两种文件: 
以K打头,后面跟两个数字以及一些字符串:表示系统到这个运行级别时所需要停止的一些服务,系统将以stop调用这个脚本。 
以S打头,后面跟两个数字以及一些字符串:表示系统到这个运行级别时所需要开始的一些服务,系统将以start调用这个脚本。 

增加启动控制脚本 
1.Identify the run level for the service 
2.Determine which services are needed by the new process 
3.Change to /etc/rc#.d and identify startup script 
4.Repeat the process for the directory containing the shutdown script 
5.Create the startup (shutdown) script in /etc/init.d 
6.Create hard links to appropriate /etc/rc#.d directories 
7.test 


改变运行级别 
init命令用于改变操作系统的运行级别。 
命令格式: 
init [ 0123456Ss ] 

# init 0 
INIT: New run level: 0 
The system is coming down. Please wait. 
System services are now being stopped. 
Print services stopped. 
Stopping the syslog service. 
syslogd: going down on signal 15 
Aug 14 14:54:30 snmpdx: received signal 15 
The system is down. 
syncing file systems... done 
Program terminated 
Type help for more information 
ok 

shutdown 
用于改变操作系统运行级别。 
命令格式: 
shutdown [ -y ] [ -g seconds ] [ -i init-state ] [message] 
选项: 
y 系统提示时默认回答为YES 
g 过多长时间改变 
i 想要的运行级别 
message 给所有登录用户的信息 

# shutdown -y -g 0 -i 0 
Shutdown started. Mon Dec 15 15:13:57 PST 1997 
Broadcast Message from root (console) on mcmurdo Mon Dec 
15 15:13:57... 
THE SYSTEM IS BEING SHUT DOWN NOW ! ! ! 
Log off now or risk your files being damaged 
Changing to init state 0 - please wait 
ok 

halt 
进入0运行级别 
poweroff 
关闭系统并切断电源 
reboot 
重新启动系统 





----
Robinhan  oicq:589210 

路过

雷人

握手

鲜花

鸡蛋

相关阅读

发表评论

最新评论

相关分类


Archiver|手机版|小黑屋|00社区

GMT+8, 2023-1-31 10:51 , Processed in 0.044773 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部