博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux services, runlevels, and rc.d scripts
阅读量:4581 次
发布时间:2019-06-09

本文共 3159 字,大约阅读时间需要 10 分钟。

Reference:

[1] https://www.linux.com/news/introduction-services-runlevels-and-rcd-scripts

A Linux service is an application (or set of applications) that runs in the background waiting to be used, or carrying out essential tasks.

In the directory /etc/rc.d, you will find either a set of files named rc.0, rc.1, rc.2, rc.3, rc.4, rc.5, and rc.6, or a set of directories named rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, and rc6.d. You will also find a file named /etc/inittab including info about runlevels.The system uses these files (and/or directories) to control the services to be started.The boot process uses these parameters to identify the default runlevel and the files that will be used by that runlevel. 

About runlevel, you might assume that this refers to different levels that the system goes through during a boot up. Instead, think of the runlevel as the point at which the system is entered. Runlevel 1 is the most basic configuration (simple single user access using an text interface), while runlevel 5 is the most advanced (multi-user, networking, and a GUI front end). Runlevels 0 and 6 are used for halting and rebooting the system. The following table shows a generic list of configurations (and some examples of different distros) taken from Linux - The Complete Reference (R.Peterson, Osbourne/McGraw-Hill).

Run Level

Generic

0 Halt Halt Halt Halt
1 Single-user mode Single-user mode Single-user mode Single-user mode
2 Basic multi-user mode (without networking) User definable (Unused) User definable - configured the same as runlevel 3 Multi-user mode
3 Full (text based) multi-user mode Multi-user mode Multi-user mode - default Slackware runlevel
4 Not used Not used X11 with KDM/GDM/XDM (session managers) Multi-user mode
5 Full (GUI based) multi-user mode Full multi-user mode (with an X-based login screen) - default runlevel User definable - configured the same as runlevel 3 Multi-user mode
6 Reboot Reboot Reboot Reboot
0:关机 1:单用户模式 2:无网络支持的多用户模式 3:有网络支持的多用户模式 4:保留,未使用 5:有网络支持有X-Window支持的多用户模式 6:重新引导系统,即重启 Linux 系统处于正常状态时,服务器主机开机(或重新启动)后,能够由系统引导器程序自动引导 Linux 系统启动到多用户模式,并提供正常的网络服务。如果系统管理员需要进行系统维护或系统出现启动异常时,就需要进入单用户模式或修复模式对系统进行管理了。使用单用户模式有一个前提,就是您的系统引导器(grub)能正常工作,否则要进行系统维护就要使用修复模式。特注:进入单用户模式,没有开启网络服务,不支持远程连接 Linux 系统中不同的运行级别(Run Level)代表了系统的不同运行状态,例如 Linux 服务器正常运行时处于运行级别3,是能够提供网络服务的多用户模式;而运行级别 1 只允许管理员通过服务器主机的单一控制台进行操作,即“单用户模式”。

Linux Boot Process

When you boot your computer, the first thing that it will do is load the bootloader -- either GRUB or LILO in most cases. The bootloader will then load the Linux kernel -- the core operating system. Next, a process called init starts. This process reads the file /etc/inittab to establish the runlevel to use. The runlevel is the start mode for the computer.

Once init knows the runlevel it will look for the appropriate files or directories as defined in /etc/initab.

Init will then either run the script files defined by /etc/initab, or run the script files in the directories defined by /etc/initab (depending on the set up of your system).

Finally, init will present you with the logon mode that you've selected.

转载于:https://www.cnblogs.com/codingforum/p/5834178.html

你可能感兴趣的文章
Leetcode中的SQL题目练习(二)
查看>>
dubbo 集群容错源码
查看>>
Collection接口的子接口——Queue接口
查看>>
LINUX安装NGINX
查看>>
服务器启动项目抛错 没有到主机的路由
查看>>
python_85_sys模块
查看>>
第九周动手动脑
查看>>
HDU 1811 Rank of Tetris
查看>>
winform 获取当前名称
查看>>
报表分栏后的排序
查看>>
Django中models定义的choices字典使用get_FooName_display()在页面中显示值
查看>>
nohup命令详解(转)
查看>>
别人的Linux私房菜(1)计算机概论
查看>>
系统编程之文件操作
查看>>
ModelState.IsValid
查看>>
菜鸟之路——机器学习之线性回归个人理解及Python实现
查看>>
opengl glut vs2013配置
查看>>
dialogPostRun 覆盖方法class Dialog 动态创建
查看>>
20170320_系统管理_部门管理2
查看>>
csust1086蘑菇真的贵,友情价更高
查看>>