1
0

sysvinit.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-sysvinit" role="wrap" revision="sysv">
  8. <?dbhtml filename="sysvinit.html"?>
  9. <sect1info condition="script">
  10. <productname>sysvinit</productname>
  11. <productnumber>&sysvinit-version;</productnumber>
  12. <address>&sysvinit-url;</address>
  13. </sect1info>
  14. <title>Sysvinit-&sysvinit-version;</title>
  15. <indexterm zone="ch-system-sysvinit">
  16. <primary sortas="a-Sysvinit">Sysvinit</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Sysvinit 软件包包含控制系统启动、运行和关闭的程序。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&sysvinit-ch6-sbu;</seg>
  26. <seg>&sysvinit-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Sysvinit</title>
  32. <!--
  33. <para>When run-levels are changed (for example, when halting the
  34. system), <command>init</command> sends termination signals to those
  35. processes that <command>init</command> itself started and that should
  36. not be running in the new run-level. While doing this,
  37. <command>init</command> outputs messages like <quote>Sending processes
  38. the TERM signal</quote> which seem to imply that it is sending these
  39. signals to all currently running processes. To avoid this
  40. misinterpretation, modify the source so that these messages read like
  41. <quote>Sending processes configured via /etc/inittab the TERM signal</quote>
  42. instead:</para>
  43. <screen><userinput remap="pre">sed -i 's@Sending processes@&amp; configured via /etc/inittab@g' src/init.c</userinput></screen>
  44. <para>Maintained versions of the <command>wall</command>,
  45. <command>mountpoint</command>, <command>last</command>,
  46. <command>mesg</command>, <command>sulogin</command>, and
  47. <command>utmpdump</command> programs were installed earlier by Util-linux.
  48. Suppress the installation of Sysvinit's versions of these programs and
  49. their man pages:</para>
  50. <screen><userinput remap="make">sed -ri -e '/utmpdump/d' \
  51. -e '/mountpoint/d' \
  52. -e '/mesg/d' \
  53. -e 's/= sulogin(\.8)?/=/' src/Makefile</userinput></screen>
  54. -->
  55. <para>首先,应用一个补丁,它会删除 sysvinit 中其他软件包已经安装的程序,
  56. 使一条消息更加清晰,并修复一个引发编译器警告的问题:</para>
  57. <screen><userinput remap="pre">patch -Np1 -i ../&sysvinit-consolidated-patch;</userinput></screen>
  58. <para>编译该软件包:</para>
  59. <screen><userinput remap="make">make</userinput></screen>
  60. <para>该软件包不包含测试套件。</para>
  61. <para>安装该软件包:</para>
  62. <screen><userinput remap="install">make install</userinput></screen>
  63. </sect2>
  64. <sect2 id="contents-sysvinit" role="content">
  65. <title>Sysvinit 的内容</title>
  66. <segmentedlist>
  67. <segtitle>安装的程序</segtitle>
  68. <seglistitem>
  69. <seg>bootlogd, fstab-decode, halt, init, killall5,
  70. poweroff (到 halt 的链接), reboot (到 halt 的链接), runlevel,
  71. shutdown, 以及 telinit (到 init 的链接)</seg>
  72. </seglistitem>
  73. </segmentedlist>
  74. <variablelist>
  75. <bridgehead renderas="sect3">简要描述</bridgehead>
  76. <?dbfo list-presentation="list"?>
  77. <?dbhtml list-presentation="table"?>
  78. <varlistentry id="bootlogd">
  79. <term><command>bootlogd</command></term>
  80. <listitem>
  81. <para>将引导消息写入日志文件</para>
  82. <indexterm zone="ch-system-sysvinit bootlogd">
  83. <primary sortas="b-bootlogd">bootlogd</primary>
  84. </indexterm>
  85. </listitem>
  86. </varlistentry>
  87. <varlistentry id="fstab-decode">
  88. <term><command>fstab-decode</command></term>
  89. <listitem>
  90. <para>以 fstab 编码的参数运行命令</para>
  91. <indexterm zone="ch-system-sysvinit fstab-decode">
  92. <primary sortas="b-fstab-decode">fstab-decode</primary>
  93. </indexterm>
  94. </listitem>
  95. </varlistentry>
  96. <varlistentry id="halt-sysv">
  97. <term><command>halt</command></term>
  98. <listitem>
  99. <para>通常以 <parameter>-h</parameter> 参数调用
  100. <command>shutdown</command>,除非已经处于运行级别 0,
  101. 这样它会通知内核停止系统运行;在系统被关闭时,它在
  102. <filename>/var/log/wtmp</filename> 文件中进行记录</para>
  103. <indexterm zone="ch-system-sysvinit halt-sysv">
  104. <primary sortas="b-halt">halt</primary>
  105. </indexterm>
  106. </listitem>
  107. </varlistentry>
  108. <varlistentry id="init-sysv">
  109. <term><command>init</command></term>
  110. <listitem>
  111. <para>内核初始化硬件后启动的第一个进程,它接管引导过程,
  112. 启动其配置文件中指定的所有进程</para>
  113. <indexterm zone="ch-system-sysvinit init-sysv">
  114. <primary sortas="b-init">init</primary>
  115. </indexterm>
  116. </listitem>
  117. </varlistentry>
  118. <varlistentry id="killall5">
  119. <term><command>killall5</command></term>
  120. <listitem>
  121. <para>向除了自身会话中以外的所有进程发送信号,
  122. 杀死多数进程,但不会杀死作为它本身父进程的 shell</para>
  123. <indexterm zone="ch-system-sysvinit killall5">
  124. <primary sortas="b-killall5">killall5</primary>
  125. </indexterm>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry id="poweroff-sysv">
  129. <term><command>poweroff</command></term>
  130. <listitem>
  131. <para>告诉内核停止系统运行并关闭电源
  132. (参阅 <command>halt</command>)</para>
  133. <indexterm zone="ch-system-sysvinit poweroff-sysv">
  134. <primary sortas="b-poweroff">poweroff</primary>
  135. </indexterm>
  136. </listitem>
  137. </varlistentry>
  138. <varlistentry id="reboot-sysv">
  139. <term><command>reboot</command></term>
  140. <listitem>
  141. <para>告诉内核重启系统 (参阅
  142. <command>halt</command>)</para>
  143. <indexterm zone="ch-system-sysvinit reboot-sysv">
  144. <primary sortas="b-reboot">reboot</primary>
  145. </indexterm>
  146. </listitem>
  147. </varlistentry>
  148. <varlistentry id="runlevel-sysv">
  149. <term><command>runlevel</command></term>
  150. <listitem>
  151. <para>报告上一次的和当前的系统运行级别,
  152. 上一次系统运行级别记录在 <filename>/var/run/utmp</filename>
  153. 中</para>
  154. <indexterm zone="ch-system-sysvinit runlevel-sysv">
  155. <primary sortas="b-runlevel">runlevel</primary>
  156. </indexterm>
  157. </listitem>
  158. </varlistentry>
  159. <varlistentry id="shutdown-sysv">
  160. <term><command>shutdown</command></term>
  161. <listitem>
  162. <para>安全地将系统下线,向所有进程发送信号,并通知所有登录用户
  163. </para>
  164. <indexterm zone="ch-system-sysvinit shutdown-sysv">
  165. <primary sortas="b-shutdown">shutdown</primary>
  166. </indexterm>
  167. </listitem>
  168. </varlistentry>
  169. <varlistentry id="telinit-sysv">
  170. <term><command>telinit</command></term>
  171. <listitem>
  172. <para>告诉 <command>init</command> 切换到哪个运行级别</para>
  173. <indexterm zone="ch-system-sysvinit telinit-sysv">
  174. <primary sortas="b-telinit">telinit</primary>
  175. </indexterm>
  176. </listitem>
  177. </varlistentry>
  178. </variablelist>
  179. </sect2>
  180. </sect1>