`
DavyJones2010
  • 浏览: 151873 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Linux: Startup Analysis III -- inittab analysis

阅读更多

 Linux startup process: 

1. inittab file (/etc/inittab)

1. All the entries in inittab file are stored with format below:

id:run-levels:action:process

id --> identifier, usually two alphabets or two degits.

run-levels --> digit from 0-6. multiple run-level can be assigned.

action --> represents the running status

process --> represents the script/command that need to be executed.

process is our main focus, and we can even ignore the id.

action:
1> initdefault: the system default run level
2> sysinit: 
3> wait: the command marked wait means the commands after this line can be executed only after the execution of this command.
4> once: start a new process and execute the command, the commands after it don't have to wait the execution of it.
5> ctrlaltdel: the command will be executed when we press ctrl+alt+del
6> powerfail: when there is error with battery/power, the command specified will be executed, and don't have to wait for end of the execution.
7> powerokwait: when the battery/power back to normal, the command specified will be executed.
8> respawn: whenever the command executed, the command should be executed again. It a command execution loop.

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Sometimes we may install sendmail, and it will execute when we start up. And its default action is wait, that means other commands have to wait the execution of it. That would take a lot of time.

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# In linux, tty means local terminal
# We can press ctrl+alt+F1~F6 to shift between different theres terminals.
# If we press ctrl+alt+F7/F8 then we will shift to x-window terminal
si::sysinit:/etc/rc.d/rc.sysinit
# id -> si
# run-levels -> empty means this init script/command should be executed no matter what the current run-level is

l0:0:wait:/etc/rc.d/rc 0
# id -> l0
# run-levels -> 0 means only execute "/etc/rc.d/rc 0" when current run level is 0

pr:12345:powerokwait:/sbin/shutdown

2. First effective line in inittab file:

id:5:initdefault

1. The default run-level is 5 which means multi-user and x-window running level.

2. We can modify this line to change the default running level when system startup.


 3. There is no process script assigned in this line, why?

 

 3. Second effective line in inittab file:

si::sysinit:/etc/rc.d/rc.sysinit

1. run-level is empty, means whatever current run-level is, this "etc/rc.d/rc.sysinit" will always be executed.

2. "etc/rc.d/rc.sysinit" is a shell script. If we want an operation executed when the system startups, we can add the command at the end of this file.

 

 4. Third segment in inittab file

l0:0:wait:/etc/rc.d/rc 0
l0:1:wait:/etc/rc.d/rc 1
l0:2:wait:/etc/rc.d/rc 2
l0:3:wait:/etc/rc.d/rc 3
l0:4:wait:/etc/rc.d/rc 4
l0:5:wait:/etc/rc.d/rc 5
l0:6:wait:/etc/rc.d/rc 6

1. As the "etc/rc.d/rc.sysinit" is the commom script for any run-levels, how can we make the difference between different run-levels?

    That is how can we make sure run-level 5 will show an x-window and run-level 3 will not?

    This is the function of segment above.

2. "etc/rc.d/rc" is a executable shell script file

ls -l /etc/rc.d/rc
-rwxr-xr-x 1 root root 2255 Jul 4 2009 /etc/rc.d/rc

 3. "etc/rc.d/rc 0" as we pass 0 to the script, the actual running script is stored in "etc/rc.d/rc0.d" directory

etc/rc.d/rc0.d
etc/rc.d/rc1.d
etc/rc.d/rc2.d
etc/rc.d/rc3.d
etc/rc.d/rc4.d
etc/rc.d/rc5.d
etc/rc.d/rc6.d

ls /etc/rc.d
init.d --> direcotory
rc0.d --> direcotory
rc1.d --> direcotory
... --> direcotory
rc.sysinit --> file
rc --> file
rc.local --> file

 4. What stores in "etc/rc.d/rc3.d"?

ls /etc/rc.d/rc3.d
K01dnsmasq
K02avahi-dnsconfd
K02NetworkManager
K05conman
K85mdmpd
S12restorecond
S55sshd

1)  S = start, means in this run level, we need to start this server.

2)  K = kill, means in this run level, we need to kill this server.

 Why should we have K ? As long as we have S, wouldn't that be enough?

 For the benefit of shifting between different run-levels.

 The number after S/K means the priority of starting/killing.

 The smaller the number is, the higher priority the service is.

 The last part is the name of the service script. 

 
 

  • 大小: 26.5 KB
  • 大小: 19.9 KB
  • 大小: 25.9 KB
分享到:
评论

相关推荐

    Vivado HLS | Export RTL报错 “ERROR: [IMPL 213-28]

    关于对2022.1.1以后VHLS不能生成IP核的解决补丁

    NordicSemiconductor::Device:Startup:8.27.0

    Error #541: 'NordicSemiconductor::Device:Startup:8.27.0' component is missing (previously found in pack 'NordicSemiconductor.nRF_DeviceFamilyPack_NordicLicense')

    StartupPitchPerfect:Startup Pitch Perfect - 初创公司的战场

    Startup Pitch Perfect - 初创公司的。 Startup Pitch Perfect 会根据“X 换 Y”的比喻自动生成一个随机的启动和标准推介平台(例如市场、产品、战略、团队)的所有幻灯片,向您的朋友推介。 现在轮到你了! 本...

    路由与交换之思科华为华三配置命令对比.docx

    - 思科:`show startup-config` - 华为:`display saved-configuration` - H3C:`display saved-configuration` 13. 显示当前配置: - 思科:`show running-config` - 华为:`display current-configuration` ...

    javaWEB总结(2): load-on-startup节点

    在Java Web开发中,`load-on-startup`节点是一个至关重要的概念,特别是在Servlet容器(如Tomcat)中。这个节点通常出现在Servlet的配置文件——web.xml中,它用于指定Servlet在Web应用程序启动时的加载顺序。`load-...

    最新版linux apache-tomcat-9.0.37.tar.gz

    5. **启动、停止和管理**:Apache Tomcat提供了一系列的脚本用于管理服务,如`bin/startup.sh`用于启动Tomcat,`bin/shutdown.sh`用于关闭Tomcat。这些脚本需要使用`sudo`权限执行。 6. **配置**:Tomcat的配置文件...

    Oracle10g视图的神图

    - **STARTUP_TIME**:启动时间。 - **LAST_BROWSED_SEQ**:最后浏览序列号。 - **LAST_BROWSED_NUM**:最后浏览编号。 - **LAST_DEQUEUE**:最后出队时间。 #### 全球固定视图(GV$ views) **概述:** 除了...

    startup-Bytedrops-2021:Starup-Bytedrops-2021

    【标题】"Startup-Bytedrops-2021"是一个与初创公司Bytedrops在2021年的活动或项目相关的主题。这个标题暗示了可能包含的是该公司的技术文档、项目代码、会议记录或者市场策略等内容,尤其关注点在于其在2021年的...

    EurekaLog_7.5.0.0_Enterprise

    2)....Fixed: Range check error in processes information for x64 machines (affects startup of any EurekaLog-enabled module) 3)....Fixed: Auto-detect personality by project extension if --el_mode switch...

    tomcat启动的问题--apr

    2010-8-11 18:24:13 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 984 ms 2010-8-11 18:24:13 org.apache.catalina.core.StandardService start 信息: Starting service Catalina ...

    MACINTOSH

    - **Bypass primary startup volume and seek a different startup volume (such as a CD or external disk)**:启动时按下 `Option-Command-Shift-Delete`,这可以让你跳过默认的启动磁盘,选择其他的启动介质如 CD...

    生物信息学软件汇总

    - **功能简介**: Startup from frame用于分析启动子区域。 #### 六、蛋白质高级结构预测 **14. 蛋白质分析综合——ScanProsite** - **网址**: <http://prosite.expasy.org/scanprosite/> - **功能简介**: ...

    C51启动文件--STARTUp.A51--详细注释.docx

    ### C51启动文件STARTUp.A51详细解析 #### 文件概述 《C51启动文件--STARTUp.A51--详细注释.docx》是一份关于C51语言编程中启动文件(STARTUp.A51)的详细介绍文档。这份文档主要针对的是使用Keil C51编译器进行...

    思科命令与华为命令对比

    - 思科:`erase startup-config`或`delete flash:startup-config` - 华为:`delete configuration` 9. **加密密码** - 思科:明文`0`,密文`7` - 华为:未直接提及,但可以使用`service password-encryption`...

    Linux下Eclipse-jdk-svn-tomcat配置.pdf

    ### Linux下Eclipse-jdk-svn-tomcat配置详解 #### 一、环境搭建与配置概述 在Linux环境下配置Eclipse、JDK、Subversion (SVN) 和 Tomcat是一项常见的开发准备工作,尤其是在进行Java Web应用程序开发时。本文将...

    XShell5-Startup-Script-master.zip

    解压后,我们可以看到一个名为"XShell5-Startup-Script-master"的文件夹,这通常包含了脚本源代码、使用说明或其他相关辅助文件。用户需要根据自己的操作系统环境,对脚本进行适当的修改和配置,然后将它设置为...

    spring-startup-analysis:用于分析Java Spring中的bean构建的简单模块

    弹簧启动分析仪 该项目被设计为一个模块,您可以通过Maven引入,它会生成类似于下... <artifactId>spring-startup-analysis <version>1.1.0 将以下基本软件包添加到您的组件中: com.github.lwaddicor.springstartu

    创建oracle的后台服务OracleServiceORCL

    其中,-STARTUP 指定启动服务,-SID 指定服务的 SID,-USRPWD 指定服务的口令,-STARTTYPE 指定服务的启动类型,-PFILE 指定服务的参数文件。 关闭服务的基本语法为: oradim -SHUTDOWN -SID sid [-USRPWD 口令] ...

    p7331323_10204_AIX5L

    Applies to: Oracle Server - Enterprise Edition - Version: 10.2.0.4 to 11.1.0.6 ...NOTE:419871.1 - Failures due to "skgxpvfymmtu: process failed because of a resource problem in the OS" on 32-bit Linux

Global site tag (gtag.js) - Google Analytics