参考:5 Best Modern Linux ‘init’ Systems (1992-2015)

参考:Linux开机流程

参考:《鸟哥的 Linux 私房菜:基础学习篇 第四版》第十七章、认识系统服务 (daemons)

在Linux和其他类Uniux系统中,init process(初始化进程)是系统启动时由内核执行的第一个进程,其PID为1。init process静默运行在后台,直到系统关闭。

init进程负责启动所有其他进程,比如守护进程、服务和其他后台进程。因此,它是系统中其它所有进程之父。一个进程可以启动许多个子进程,如果在子进程没死之前父进程死了,孤儿进程(orphan process)的父进程会变成init进程。

init system就是内核之后的第一个程序,也就是init process。

如果init process无法启动,后面将不会启动任何进程,系统将进入一个名为“Kernel Panic”的阶段。

这么多年过去了,许多的init system在主流Linux发行版中脱颖而出。

System V Init

  System V (SysV) 是一个在类 Unix 系统中最成熟最受欢迎的init system,也是第一个商业 Unix 系统的init system。除了 Gentoo 使用自主的init system、Slackware 使用 BSD 风格的init system外,几乎所有的 Linux 发行版都率先使用 SysV 作为init system。SysV是 Unix/Linux 系统中所有进程的父进程。很多时候我们说init进程,实际上指的就是SysV。操作系统内核第一个调用的程序就是init,然后init去唤醒所有系统必须服务(本机的或者远端的)。
  随着时间的推移,SysV 由于一些设计上的缺陷,有几个 替代init scheme被开发出来。这些init scheme为 Linux 提供更加高效和完美的init system。 尽管这些替代方案都超越了 SysV 并提供了更多新特性,但它们仍然和原始 SysV 初始化脚本保持兼容。

CentOS 7.X后,便由systemd替代init。如果你去/etc/init.d/下面会有个README提示你

You are looking for the traditional init scripts in /etc/rc.d/init.d,
and they are gone?

Here's an explanation on what's going on:

You are running a systemd-based OS where traditional init scripts have
been replaced by native systemd services files. Service files provide
very similar functionality to init scripts. To make use of service
files simply invoke "systemctl", which will output a list of all
currently running services (and other units). Use "systemctl
list-unit-files" to get a listing of all known unit files, including
stopped, disabled and masked ones. Use "systemctl start
foobar.service" and "systemctl stop foobar.service" to start or stop a
service, respectively. For further details, please refer to
systemctl(1).

Note that traditional init scripts continue to function on a systemd
system. An init script /etc/rc.d/init.d/foobar is implicitly mapped
into a service unit foobar.service during system initialization.

Thank you!

Further reading:
        man:systemctl(1)
        man:systemd(1)
        http://0pointer.de/blog/projects/systemd-for-admins-3.html
        http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities
View Code

相关文章:

  • 2021-12-29
  • 2022-01-22
  • 2021-09-17
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2021-12-11
猜你喜欢
  • 2021-06-27
  • 2021-11-21
  • 2021-04-30
  • 2021-11-11
  • 2021-07-07
  • 2022-12-23
相关资源
相似解决方案