usage.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
  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. <!ENTITY site SYSTEM "../appendices/rc.site.script">
  6. %general-entities;
  7. ]>
  8. <sect1 id="ch-scripts-usage" revision="sysv">
  9. <?dbhtml filename="usage.html"?>
  10. <title>System V 启动脚本使用与配置</title>
  11. <indexterm zone="ch-scripts-usage">
  12. <primary sortas="a-Bootscripts">Bootscripts</primary>
  13. <secondary>usage</secondary>
  14. </indexterm>
  15. <sect2>
  16. <title>System V 启动脚本如何工作?</title>
  17. <!--para>Linux uses a special booting facility named SysVinit that is based on a
  18. concept of <emphasis>run-levels</emphasis>. It can be quite different from one
  19. system to another, so it cannot be assumed that because things worked in one
  20. particular Linux distribution, they should work the same in LFS too. LFS has its
  21. own way of doing things, but it respects generally accepted standards.</para-->
  22. <para>Linux 使用一种称为 SysVinit 的特殊引导架构,它基于
  23. <emphasis>运行级别</emphasis> (run-level)的概念而构建。
  24. 不同系统的 SysVinit 可能会区别很大,
  25. 因此不能假设那些在某个 Linux 发行版上正常工作的方法也能在 LFS
  26. 正常工作。LFS 有自己的处事原则,但它也遵守被广泛接受的标准。
  27. </para>
  28. <!--para>SysVinit (which will be referred to as <quote>init</quote> from now on)
  29. works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
  30. (actually, there are more run-levels, but they are for special cases and are
  31. generally not used. See <filename>init(8)</filename> for more details), and
  32. each one of those corresponds to the actions the computer is supposed to
  33. perform when it starts up. The default run-level is 3. Here are the
  34. descriptions of the different run-levels as they are implemented:</para-->
  35. <para>SysVinit(之后简称为 <quote>init</quote>)使用运行级别架构工作。
  36. 有七个(编号为 0 到 6)运行级别(实际上还有更多,
  37. 但它们用于一些特殊情况,一般并不使用。参阅
  38. <filename>init(8)</filename> 了解更多细节),
  39. 每个都对应于计算机在启动时应该进行的一组操作。
  40. 默认运行级别是 3,下面是不同运行级别的描述:</para>
  41. <literallayout>0: 停止系统运行
  42. 1: 单用户模式
  43. 2: 没有网络的多用户模式
  44. 3: 有网络的多用户模式
  45. 4: 保留用于自定义,如果没有自定义,和 3 相同
  46. 5: 和 4 相同,一般用于 GUI 登录 (如 X 的 <command>xdm</command> 或 KDE 的 <command>kdm</command>)
  47. 6: 重启计算机</literallayout>
  48. </sect2>
  49. <sect2 id="conf-sysvinit" role="configuration">
  50. <title>配置 Sysvinit</title>
  51. <indexterm zone="conf-sysvinit">
  52. <primary sortas="a-Sysvinit">Sysvinit</primary>
  53. <secondary>configuring</secondary>
  54. </indexterm>
  55. <indexterm zone="conf-sysvinit">
  56. <primary sortas="e-/etc/inittab">/etc/inittab</primary>
  57. </indexterm>
  58. <!--para>During the kernel initialization, the first program that is run
  59. is either specified on the command line or, by default
  60. <command>init</command>. This program reads the initialization file
  61. <filename>/etc/inittab</filename>. Create this file with:</para-->
  62. <para>在内核初始化过程中,第一个运行的程序要么是内核命令行中指定的程序,
  63. 要么默认为 <command>init</command>。该程序读取初始化文件
  64. <filename>/etc/inittab</filename>,执行以下命令创建该文件:</para>
  65. <screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
  66. <literal># Begin /etc/inittab
  67. id:3:initdefault:
  68. si::sysinit:/etc/rc.d/init.d/rc S
  69. l0:0:wait:/etc/rc.d/init.d/rc 0
  70. l1:S1:wait:/etc/rc.d/init.d/rc 1
  71. l2:2:wait:/etc/rc.d/init.d/rc 2
  72. l3:3:wait:/etc/rc.d/init.d/rc 3
  73. l4:4:wait:/etc/rc.d/init.d/rc 4
  74. l5:5:wait:/etc/rc.d/init.d/rc 5
  75. l6:6:wait:/etc/rc.d/init.d/rc 6
  76. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
  77. su:S016:once:/sbin/sulogin
  78. 1:2345:respawn:/sbin/agetty --noclear tty1 9600
  79. 2:2345:respawn:/sbin/agetty tty2 9600
  80. 3:2345:respawn:/sbin/agetty tty3 9600
  81. 4:2345:respawn:/sbin/agetty tty4 9600
  82. 5:2345:respawn:/sbin/agetty tty5 9600
  83. 6:2345:respawn:/sbin/agetty tty6 9600
  84. # End /etc/inittab</literal>
  85. EOF</userinput></screen>
  86. <!--para>An explanation of this initialization file is in the man page for
  87. <emphasis>inittab</emphasis>. For LFS, the key command that is run is
  88. <command>rc</command>. The initialization file above will instruct
  89. <command>rc</command> to run all the scripts starting with an S in the
  90. <filename class="directory">/etc/rc.d/rcS.d</filename> directory
  91. followed by all the scripts starting with an S in the <filename
  92. class="directory">/etc/rc.d/rc?.d</filename> directory where the question
  93. mark is specified by the initdefault value.</para-->
  94. <para>在 <emphasis>inittab</emphasis> 的 man
  95. 页面中可以找到对该初始化文件的解释。对于 LFS,被执行的关键命令是
  96. <command>rc</command>。上面的初始化文件会告诉 <command>rc</command>
  97. 先运行 <filename class="directory">/etc/rc.d/rcS.d</filename>
  98. 目录中所有名字以 S 开头的脚本,再运行
  99. <filename class="directory">/etc/rc.d/rc?.d</filename>
  100. 中所有名字以 S 开头的脚本,这里问号表示 initdefault 值指定的默认运行级别。
  101. </para>
  102. <!--para>As a convenience, the <command>rc</command> script reads a library of
  103. functions in <filename class="directory">/lib/lsb/init-functions</filename>.
  104. This library also reads an optional configuration file,
  105. <filename>/etc/sysconfig/rc.site</filename>. Any of the system
  106. configuration file parameters described in subsequent sections can be
  107. alternatively placed in this file allowing consolidation of all system
  108. parameters in this one file.</para-->
  109. <para>为了方便起见,<command>rc</command> 脚本从
  110. <filename class="directory">/lib/lsb/init-functions</filename>
  111. 中读取脚本函数库,这个库又会读取一个可选的配置文件
  112. <filename>/etc/sysconfig/rc.site</filename>。
  113. 如果您希望将所有系统参数集中到一个文件中,
  114. 可以将以下各节中描述的所有系统配置文件参数都写入这一个文件。</para>
  115. <!--para>As a debugging convenience, the functions script also logs all output
  116. to <filename>/run/var/bootlog</filename>. Since the <filename
  117. class="directory">/run</filename> directory is a tmpfs, this file is not
  118. persistent across boots, however it is appended to the more permanent file
  119. <filename>/var/log/boot.log</filename> at the end of the boot process.</para-->
  120. <para>为了方便调试,脚本函数库会将所有输出记录到
  121. <filename>/run/var/bootlog</filename>。由于
  122. <filename class="directory">/run</filename> 是 tmpfs,
  123. 这个文件在重新启动时不会被保留。然而,在引导过程结束时,
  124. 该文件的内容会被附加到更持久化的 <filename>/var/log/boot.log</filename>
  125. 文件末尾。</para>
  126. <sect3 id="init-levels" >
  127. <title>切换运行级别</title>
  128. <para>通过运行 <command>init
  129. <replaceable>&lt;runlevel&gt;</replaceable></command> 可以切换运行级别,
  130. 这里 <replaceable>&lt;runlevel&gt;</replaceable> 是要切换到的运行级别。
  131. 例如,如果要重新启动计算机,用户可以使用 <command>init 6</command> 命令,
  132. 它和 <command>reboot</command> 作用相同。同样,
  133. <command>init 0</command> 和 <command>halt</command> 作用相同。</para>
  134. <!--para>There are a number of directories under <filename
  135. class="directory">/etc/rc.d</filename> that look like <filename
  136. class="directory">rc?.d</filename> (where ? is the number of the run-level) and
  137. <filename class="directory">rcsysinit.d</filename>, all containing a number of
  138. symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
  139. an <emphasis>S</emphasis>, and all of them have two numbers following the
  140. initial letter. The K means to stop (kill) a service and the S means to start a
  141. service. The numbers determine the order in which the scripts are run, from 00
  142. to 99&mdash;the lower the number the earlier it gets executed. When
  143. <command>init</command> switches to another run-level, the appropriate services
  144. are either started or stopped, depending on the runlevel chosen.</para-->
  145. <para>在 <filename class="directory">/etc/rc.d</filename>
  146. 中有一些名字类似 <filename class="directory">rc?.d</filename>
  147. 的目录(这里 ? 是运行级别编号),以及一个目录
  148. <filename class="directory">rcsysinit.d</filename>,
  149. 这些目录都包含一些符号链接。有的符号链接的名字以 <emphasis>K</emphasis>
  150. 开头,其他的则以 <emphasis>S</emphasis> 开头。它们的名字中,
  151. 第一个字符后都有两位数字。K 表示停止(杀死,kill)一个服务,
  152. 而 S 表示启动(start)一个服务。两位数字决定了运行这些脚本的顺序,
  153. 从 00 到 99 —— 数字较小的脚本更早执行。当 <command>init</command>
  154. 切换到另一个运行级别时,它会执行这些脚本,从而适当地启动或停止服务,
  155. 满足选择的运行级别要求。</para>
  156. <para>符号链接实际指向的脚本位于 <filename
  157. class="directory">/etc/rc.d/init.d</filename>,它们完成实际的工作。
  158. K 链接和 S 链接指向
  159. <filename class="directory">/etc/rc.d/init.d</filename>
  160. 中的相同脚本,这是因为脚本接受不同的参数,如
  161. <parameter>start</parameter>、<parameter>stop</parameter>、
  162. <parameter>restart</parameter>、<parameter>reload</parameter> 以及
  163. <parameter>status</parameter>。当发现 K 链接时,脚本被传递
  164. <parameter>stop</parameter> 参数。当发现 S 链接时,
  165. 对应的脚本被传递 <parameter>start</parameter> 参数。</para>
  166. <para>以上解释有一个例外情况,当 <filename
  167. class="directory">rc0.d</filename> 和 <filename
  168. class="directory">rc6.d</filename> 目录中出现以 <emphasis>S</emphasis>
  169. 开头的链接时,它们不会启动任何服务。相反,它们被以参数
  170. <parameter>stop</parameter> 调用,并停止服务。
  171. 这一行为背后的逻辑是,在重新启动系统或停止系统运行时,不需要启动任何服务,
  172. 只需要停止整个系统。</para>
  173. <para>下面是脚本接受的不同参数及其解释:</para>
  174. <variablelist>
  175. <varlistentry>
  176. <term><parameter>start</parameter></term>
  177. <listitem>
  178. <para>启动服务。</para>
  179. </listitem>
  180. </varlistentry>
  181. <varlistentry>
  182. <term><parameter>stop</parameter></term>
  183. <listitem>
  184. <para>停止服务。</para>
  185. </listitem>
  186. </varlistentry>
  187. <varlistentry>
  188. <term><parameter>restart</parameter></term>
  189. <listitem>
  190. <para>停止服务,再重新启动它。</para>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry>
  194. <term><parameter>reload</parameter></term>
  195. <listitem>
  196. <para>更新服务配置。
  197. 当服务的配置文件被修改后,如果不需要重新启动服务,
  198. 就使用该参数。</para>
  199. </listitem>
  200. </varlistentry>
  201. <varlistentry>
  202. <term><parameter>status</parameter></term>
  203. <listitem>
  204. <para>报告服务是否在运行中。如果正在运行,报告其 PID。</para>
  205. </listitem>
  206. </varlistentry>
  207. </variablelist>
  208. <para>您可以自由地修改引导过程的工作方式(毕竟这是您自己的 LFS 系统)。
  209. 我们给出的文件只是示例,用于展示它们可以完成的任务。</para>
  210. </sect3>
  211. </sect2>
  212. <sect2>
  213. <title>Udev 启动脚本</title>
  214. <para><filename>/etc/rc.d/init.d/udev</filename> 初始化脚本启动
  215. <command>udevd</command>,
  216. 触发内核已经创建的<quote>冷插拔</quote>设备,
  217. 等待其 udev 规则执行完毕。该脚本也会取消默认的 uevent 处理程序
  218. <filename>/sbin/hotplug</filename>,
  219. 因为现在内核不再需要调用外部二进制程序,相反,
  220. <command>udevd</command> 会监听一个 netlink 套接字,
  221. 以获取内核发出的 uevent 事件。</para>
  222. <!--para>The <command>/etc/rc.d/init.d/udev_retry</command> initscript takes
  223. care of re-triggering events for subsystems whose rules may rely on
  224. filesystems that are not mounted until the <command>mountfs</command>
  225. script is run (in particular, <filename class="directory">/usr</filename>
  226. and <filename class="directory">/var</filename> may cause this). This
  227. script runs after the <command>mountfs</command> script, so those rules
  228. (if re-triggered) should succeed the second time around. It is
  229. configured from the <filename>/etc/sysconfig/udev_retry</filename> file;
  230. any words in this file other than comments are considered subsystem names
  231. to trigger at retry time. To find the subsystem of a device, use
  232. <command>udevadm info - -attribute-walk &lt;device&gt;</command> where
  233. &lt;device&gt; is an absolute path in /dev or /sys such as /dev/sr0 or
  234. /sys/class/rtc.</para-->
  235. <para>某些子系统的 udev 规则依赖于一些直到 <command>mount_fs</command>
  236. 脚本被执行才会挂载的文件系统(如独立的
  237. <filename class="directory">/usr</filename> 和
  238. <filename class="directory">/var</filename> 文件系统就会导致这种现象)
  239. 初始化脚本 <command>/etc/rc.d/init.d/udev_retry</command>
  240. 负责重新触发这些子系统的事件。该脚本在 <command>mountfs</command>
  241. 后运行,因此这些规则(如果被重新触发)这一次应该能够成功执行。
  242. 配置文件 <filename>/etc/sysconfig/udev_retry</filename>
  243. 中包含的除注释外的所有单词都会被认为是一个需要触发的子系统。
  244. 为了找到某个设备的子系统,执行
  245. <command>udevadm info --attribute-walk &lt;device&gt;</command>,
  246. 这里 &lt;device&gt; 是一个 /dev 或 /sys 中的绝对路径,
  247. 例如 /dev/sr0 或 /sys/class/rtc。</para>
  248. <note><title>译注</title>
  249. <para>原文中这里有两小节与之前的
  250. <xref linkend="ch-module-loading"/>、
  251. <xref linkend="ch-hotplug-device"/> 重复,这里删去了。
  252. 上游将在 LFS 手册的下一个版本中删除它们。
  253. </para>
  254. </note>
  255. </sect2>
  256. <sect2 id="ch-scripts-clock">
  257. <title>配置系统时钟</title>
  258. <indexterm zone="ch-scripts-clock">
  259. <primary sortas="d-scripts-setclock">setclock</primary>
  260. <secondary>configuring</secondary></indexterm>
  261. <!--para>The <command>setclock</command> script reads the time from the hardware
  262. clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
  263. (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
  264. hardware clock's time to the local time using the
  265. <filename>/etc/localtime</filename> file (which tells the
  266. <command>hwclock</command> program which timezone the user is in). There is no
  267. way to detect whether or not the hardware clock is set to UTC, so this
  268. needs to be configured manually.</para-->
  269. <para><command>setclock</command> 脚本从硬件时钟读取时间,
  270. 硬件时钟又被称为 BIOS 时钟或互补金属氧化物半导体(CMOS)时钟。
  271. 如果硬件时钟被设为 UTC 时间,该脚本会根据
  272. <filename>/etc/localtime</filename> 文件(它告知
  273. <command>hwclock</command> 程序用户处于哪个时区),
  274. 将硬件时钟的时间转换成本地时间。不存在确定硬件时钟是否设为 UTC 的方法,
  275. 因此这必须手动设置。</para>
  276. <!--para>The <command>setclock</command> is run via
  277. <application>udev</application> when the kernel detects the hardware
  278. capability upon boot. It can also be run manually with the stop parameter to
  279. store the system time to the CMOS clock.</para-->
  280. <para>在引导后,内核检测硬件功能时,<command>setclock</command> 脚本被
  281. <application>udev</application> 执行。可以用 stop 参数手动调用它,
  282. 以将系统时间写入 CMOS 时钟。</para>
  283. <!--para>If you cannot remember whether or not the hardware clock is set to UTC,
  284. find out by running the <userinput>hwclock localtime show</userinput>
  285. command. This will display what the current time is according to the hardware
  286. clock. If this time matches whatever your watch says, then the hardware clock is
  287. set to local time. If the output from <command>hwclock</command> is not local
  288. time, chances are it is set to UTC time. Verify this by adding or subtracting
  289. the proper amount of hours for the timezone to the time shown by
  290. <command>hwclock</command>. For example, if you are currently in the MST
  291. timezone, which is also known as GMT -0700, add seven hours to the local
  292. time.</para-->
  293. <para>如果您不确定您的硬件时钟是否设置为 UTC ,运行
  294. <userinput>hwclock --localtime --show</userinput> 命令,
  295. 它会显示硬件时钟给出的当前时间。如果这个时间和您的手表显示的一致,
  296. 则说明硬件时钟被设定为本地时间。相反,如果 <command>hwclock</command>
  297. 输出的时间不是本地时间,则硬件时钟很可能被设定为 UTC 时间。
  298. 根据您的时区,在 <command>hwclock</command>
  299. 显示的时间上加减对应的小时数,进行进一步的验证。
  300. 例如,如果您现在处于莫斯科时区,即 GMT -0700 ,在本地时间上加
  301. 7 小时,再进行比较。</para>
  302. <!--para>Change the value of the <envar>UTC</envar> variable below
  303. to a value of <parameter>0</parameter> (zero) if the hardware clock
  304. is <emphasis>not</emphasis> set to UTC time.</para-->
  305. <para>如果硬件时钟<emphasis>没有</emphasis>设为 UTC 时间,
  306. 在下面的配置文件中,应该将 <envar>UTC</envar> 变量的值设为
  307. <parameter>0</parameter>。</para>
  308. <note><title>译注</title>
  309. <para>Windows 会将硬件时钟设定为本地时间,因此如果您要同时安装
  310. Windows 和 Linux,就要将 Linux (包括 LFS 和其他发行版)
  311. 配置为使用本地时间,除非能够忍受 Windows 和 Linux 显示的不同时间
  312. (必有一个是错误的)。
  313. </para></note>
  314. <!--para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
  315. the following:</para-->
  316. <para>执行以下命令,创建一个新的
  317. <filename>/etc/sysconfig/clock</filename> 文件:</para>
  318. <screen><userinput>cat &gt; /etc/sysconfig/clock &lt;&lt; "EOF"
  319. <literal># Begin /etc/sysconfig/clock
  320. UTC=1
  321. # 将该变量设置为您希望传递给 hwclock 命令的选项,
  322. # 例如 Alpha 机器上的硬件时钟类型。
  323. CLOCKPARAMS=
  324. # End /etc/sysconfig/clock</literal>
  325. EOF</userinput></screen>
  326. <!--para>A good hint explaining how to deal with time on LFS is available
  327. at <ulink url="&hints-root;time.txt"/>. It explains issues such as
  328. time zones, UTC, and the <envar>TZ</envar> environment variable.</para-->
  329. <para>访问 <ulink url="&hints-root;time.txt"/> ,
  330. 可以找到一个关于如何在 LFS 系统中处理时间问题的好的提示。
  331. 它解释了时区、UTC 和 <envar>TZ</envar> 环境变量等问题。</para>
  332. <note><para>CLOCKPARAMS 和 UTC 参数也可在
  333. <filename>/etc/sysconfig/rc.site</filename> 文件中设定。</para></note>
  334. </sect2>
  335. <sect2 id="ch-scripts-console">
  336. <?dbhtml filename="console.html"?>
  337. <title>配置 Linux 控制台</title>
  338. <indexterm zone="ch-scripts-console">
  339. <primary sortas="d-console">console</primary>
  340. <secondary>configuring</secondary>
  341. </indexterm>
  342. <!--para>This section discusses how to configure the <command>console</command>
  343. bootscript that sets up the keyboard map, console font and console kernel log
  344. level. If non-ASCII characters (e.g., the copyright sign, the British pound
  345. sign and Euro symbol) will not be used and the keyboard is a U.S. one, much
  346. of this section can be skipped. Without the configuration file, (or
  347. equivalent settings in <filename>rc.site</filename>), the
  348. <command>console</command> bootscript will do nothing.</para-->
  349. <para>本节讨论如何配置 <command>console</command> 启动脚本,
  350. 使之正确设定键盘映射、控制台字体和控制台内核日志级别。
  351. 如果不使用非 ASCII 字符(如版权符号、英镑或欧元符号),
  352. 且键盘是美式的,则可以跳过本节。如果不创建本节的配置文件
  353. (且 <filename>rc.site</filename> 中也没有对应的设置),
  354. 则 <command>console</command> 脚本什么也不做。</para>
  355. <!--para>The <command>console</command> script reads the
  356. <filename>/etc/sysconfig/console</filename> file for configuration
  357. information. Decide which keymap and screen font will be used. Various
  358. language-specific HOWTOs can also help with this, see <ulink
  359. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  360. doubt, look in the <filename class="directory">/usr/share/keymaps</filename>
  361. and <filename class="directory">/usr/share/consolefonts</filename> directories
  362. for valid keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
  363. <filename>setfont(8)</filename> manual pages to determine the correct
  364. arguments for these programs.</para-->
  365. <para><command>console</command> 脚本读取
  366. <filename>/etc/sysconfig/console</filename> 文件中的配置信息,
  367. 据此确定使用哪种键映射和控制台字体。一些与特定语言相关的
  368. HOWTO 文档可以帮助您进行配置,参阅
  369. <ulink url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>。
  370. 如果仍然存在疑问,在
  371. <filename class="directory">/usr/share/keymaps</filename> 和
  372. <filename class="directory">/usr/share/consolefonts</filename>
  373. 目录中寻找可用的键映射和屏幕字体,并阅读 <filename>loadkeys(1)</filename>
  374. 和 <filename>setfont(8)</filename> man 手册页面,
  375. 以确认应该传递给这两个程序的正确参数。</para>
  376. <!--para>The <filename>/etc/sysconfig/console</filename> file should contain lines
  377. of the form: VARIABLE="value". The following variables are recognized:</para-->
  378. <para><filename>/etc/sysconfig/console</filename>
  379. 文件应当包含若干行,它们的格式为:变量名="值"。下列变量名会被识别:</para>
  380. <variablelist>
  381. <varlistentry>
  382. <term>LOGLEVEL</term>
  383. <listitem>
  384. <!--para>This variable specifies the log level for kernel messages sent
  385. to the console as set by <command>dmesg</command>. Valid levels are
  386. from "1" (no messages) to "8". The default level is "7".</para-->
  387. <para>该变量指定被发送到终端的内核消息日志等级,
  388. 正如使用 <command>dmesg -n</command> 设置的那样。
  389. 有效的等级是 "1"(不输出消息) 到 "8" 之间的某个数,
  390. 默认值是 "7"。</para>
  391. </listitem>
  392. </varlistentry>
  393. <varlistentry>
  394. <term>KEYMAP</term>
  395. <listitem>
  396. <!--para>This variable specifies the arguments for the
  397. <command>loadkeys</command> program, typically, the name of keymap
  398. to load, e.g., <quote>it</quote>. If this variable is not set, the
  399. bootscript will not run the <command>loadkeys</command> program,
  400. and the default kernel keymap will be used. Note that a few keymaps
  401. have multiple versions with the same name (cz and its variants in
  402. qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and
  403. qwerty/). In these cases the parent directory should also be specified
  404. (e.g. qwerty/es) to ensure the proper keymap is loaded.
  405. </para-->
  406. <para>该变量指定传递给 <command>loadkeys</command> 程序的参数,
  407. 通常为希望加载的键映射表名,例如 <quote>it</quote>。
  408. 如果没有设置这个变量,启动脚本不会运行 <command>loadkeys</command>,
  409. 并使用默认键映射。注意某些键映射表有名字相同的不同版本
  410. (如 cz 及其变式在 qwerty/ 和 qwertz/ 中同时存在,
  411. es 在 olpc/ 和 qwerty/ 中同时存在,trf 在 fgGIod/ 和 qwerty/
  412. 中同时存在),此时就要把包含键映射表文件的目录名也写在该变量中
  413. (如 qwerty/es),才能保证加载正确的键映射。</para>
  414. </listitem>
  415. </varlistentry>
  416. <varlistentry>
  417. <term>KEYMAP_CORRECTIONS</term>
  418. <listitem>
  419. <!--para>This (rarely used) variable
  420. specifies the arguments for the second call to the
  421. <command>loadkeys</command> program. This is useful if the stock keymap
  422. is not completely satisfactory and a small adjustment has to be made. E.g.,
  423. to include the Euro sign into a keymap that normally doesn't have it,
  424. set this variable to <quote>euro2</quote>.</para-->
  425. <para>这个(很少使用的)变量指定第二次调用
  426. <command>loadkeys</command> 程序时的参数。
  427. 如果您希望对现成的,但不完全符合要求的键映射表进行微调,
  428. 这个变量很有用。例如,为了在不包含欧元符号的键映射中附加它,
  429. 可以设定该变量为 <quote>euro2</quote>。</para>
  430. </listitem>
  431. </varlistentry>
  432. <varlistentry>
  433. <term>FONT</term>
  434. <listitem>
  435. <!--para>This variable specifies the arguments for the
  436. <command>setfont</command> program. Typically, this includes the font
  437. name, <quote>-m</quote>, and the name of the application character
  438. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  439. together with the <quote>8859-1</quote> application character map
  440. (as it is appropriate in the USA),-->
  441. <!-- because of the copyright sign -->
  442. <!-- set this variable to <quote>lat1-16 -m 8859-1</quote>.
  443. In UTF-8 mode, the kernel uses the application character map for
  444. conversion of composed 8-bit key codes in the keymap to UTF-8, and thus
  445. the argument of the "-m" parameter should be set to the encoding of the
  446. composed key codes in the keymap.</para-->
  447. <para>该变量指定传递给 <command>setfont</command> 程序的参数。
  448. 它一般包含字体名、<quote>-m</quote> 以及需要加载的应用字符映射名,
  449. 例如,如果要加载 <quote>lat1-16</quote> 字体,以及
  450. <quote>8859-1</quote> 应用字符映射(它适用于美国),
  451. 就将该变量设置为 <quote>lat1-16 -m 8859-1</quote>。
  452. 在 UTF-8 模式下,内核根据应用字符映射,将键映射中的
  453. 8 位键码组合转换成 UTF-8,因此 <quote>-m</quote>
  454. 参数的值应该被设为键映射中键码组合的编码。</para>
  455. </listitem>
  456. </varlistentry>
  457. <varlistentry>
  458. <term>UNICODE</term>
  459. <listitem>
  460. <!--para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  461. <quote>true</quote> in order to put the
  462. console into UTF-8 mode. This is useful in UTF-8 based locales and
  463. harmful otherwise.</para-->
  464. <para>将该变量设置为 <quote>1</quote>、<quote>yes</quote> 或
  465. <quote>true</quote>,可以将终端设置为 UTF-8 模式。
  466. 这对于基于 UTF-8 的 locale 来说很有用,但对于其他 locale 有害。
  467. </para>
  468. </listitem>
  469. </varlistentry>
  470. <varlistentry>
  471. <term>LEGACY_CHARSET</term>
  472. <listitem>
  473. <!--para>For many keyboard layouts, there is no stock Unicode keymap in
  474. the Kbd package. The <command>console</command> bootscript will
  475. convert an available keymap to UTF-8 on the fly if this variable is
  476. set to the encoding of the available non-UTF-8 keymap.</para-->
  477. <para>对于许多键盘布局,Kbd 软件包不包含现成的 Unicode 键映射。
  478. 如果将该变量设置为可用的非 UTF-8 键映射的编码,则
  479. <command>console</command>
  480. 启动脚本会将可用的键映射即时转换成 UTF-8。</para>
  481. </listitem>
  482. </varlistentry>
  483. </variablelist>
  484. <para>一些例子:</para>
  485. <itemizedlist>
  486. <listitem>
  487. <!--para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  488. generally needed. E.g., for a Polish setup, one would use:</para-->
  489. <para>对于非 Unicode 设置,一般只需要 KEYMAP 和 FONT 变量。
  490. 例如,下面是一个波兰语设置:</para>
  491. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  492. <literal># Begin /etc/sysconfig/console
  493. KEYMAP="pl2"
  494. FONT="lat2a-16 -m 8859-2"
  495. # End /etc/sysconfig/console</literal>
  496. EOF</userinput></screen>
  497. </listitem>
  498. <listitem>
  499. <!--para>As mentioned above, it is sometimes necessary to adjust a
  500. stock keymap slightly. The following example adds the Euro symbol to the
  501. German keymap:</para-->
  502. <para>正如前文所述,有时需要微调一个现有的键映射,
  503. 下面的例子为德语键映射增加欧元符号:</para>
  504. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  505. <literal># Begin /etc/sysconfig/console
  506. KEYMAP="de-latin1"
  507. KEYMAP_CORRECTIONS="euro2"
  508. FONT="lat0-16 -m 8859-15"
  509. # End /etc/sysconfig/console</literal>
  510. EOF</userinput></screen>
  511. </listitem>
  512. <listitem>
  513. <!--para>The following is a Unicode-enabled example for Bulgarian, where a
  514. stock UTF-8 keymap exists:</para-->
  515. <para>下面是使用 Unicode 的白罗斯语配置,对于该语言,
  516. 可以使用已有的 UTF-8 键映射:</para>
  517. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  518. <literal># Begin /etc/sysconfig/console
  519. UNICODE="1"
  520. KEYMAP="bg_bds-utf8"
  521. FONT="LatArCyrHeb-16"
  522. # End /etc/sysconfig/console</literal>
  523. EOF</userinput></screen>
  524. </listitem>
  525. <listitem>
  526. <!--para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  527. example, bright colors are no longer available on the Linux console unless
  528. a framebuffer is used. If one wants to have bright colors without
  529. framebuffer and can live without characters not belonging to his language,
  530. it is still possible to use a language-specific 256-glyph font, as
  531. illustrated below:</para-->
  532. <para>由于上面的例子使用了 512 个字形的 LatArCyrHeb-16 字体,
  533. 在 Linux 终端中不能继续使用明亮的颜色,除非使用了帧缓冲。
  534. 如果希望在没有帧缓冲的情况下使用明亮的颜色,
  535. 且不需要那些不属于自己母语的字符,可以使用特定语言的 256 字形字体,
  536. 配置文件如下:</para>
  537. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  538. <literal># Begin /etc/sysconfig/console
  539. UNICODE="1"
  540. KEYMAP="bg_bds-utf8"
  541. FONT="cyr-sun16"
  542. # End /etc/sysconfig/console</literal>
  543. EOF</userinput></screen>
  544. </listitem>
  545. <listitem>
  546. <!--para>The following example illustrates keymap autoconversion from
  547. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para-->
  548. <para>下面的例子展示了从 ISO-8859-15 到 UTF-8 的键映射自动转换,
  549. 同时在 Unicode 模式下启用了死键:</para>
  550. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  551. <literal># Begin /etc/sysconfig/console
  552. UNICODE="1"
  553. KEYMAP="de-latin1"
  554. KEYMAP_CORRECTIONS="euro2"
  555. LEGACY_CHARSET="iso-8859-15"
  556. FONT="LatArCyrHeb-16 -m 8859-15"
  557. # End /etc/sysconfig/console</literal>
  558. EOF</userinput></screen>
  559. </listitem>
  560. <listitem>
  561. <!--para>Some keymaps have dead keys (i.e., keys that don't produce a
  562. character by themselves, but put an accent on the character produced
  563. by the next key) or define composition rules (such as: <quote>press
  564. Ctrl+. A E to get &AElig;</quote> in the default keymap).
  565. Linux-&linux-version; interprets dead keys and composition rules in the
  566. keymap correctly only when the source characters to be composed together
  567. are not multibyte. This deficiency doesn't affect keymaps for European
  568. languages, because there accents are added to unaccented ASCII
  569. characters, or two ASCII characters are composed together. However, in
  570. UTF-8 mode it is a problem, e.g., for the Greek language, where one
  571. sometimes needs to put an accent on the letter <quote>alpha</quote>.
  572. The solution is either to avoid the use of UTF-8, or to install the
  573. X window system that doesn't have this limitation in its input
  574. handling.</para-->
  575. <para>某些键映射有死键(即,这些键本身不产生字符,
  576. 而是在下一次按键产生的字符上附加音调)或定义了组合规则
  577. (例如在默认键映射中,<quote>按下 Ctrl+. A E 得到 &AElig;</quote>)。
  578. Linux-&linux-version; 只有在被组合的不是多字节字符的情况下,
  579. 才能正常解析死键和组合规则。这个缺陷不影响欧洲语言的键映射,
  580. 因为在欧洲语言中要么是一个音调被附加到不带音调的 ASCII 字符上,
  581. 要么是两个 ASCII 字符被组合在一起。然而,在 UTF-8 模式中,
  582. 以希腊语为例,当某人要在 <quote>alpha</quote> 字符上附加一个音调时,
  583. 就会出现问题。解决方法是要么不使用 UTF-8,要么安装 X 窗口系统,
  584. 它处理输入时没有这个限制。</para>
  585. </listitem>
  586. <listitem>
  587. <!--para>For Chinese, Japanese, Korean and some other languages, the Linux
  588. console cannot be configured to display the needed characters. Users
  589. who need such languages should install the X Window System, fonts that
  590. cover the necessary character ranges, and the proper input method (e.g.,
  591. SCIM, it supports a wide variety of languages).</para-->
  592. <para>对于中文、日文、韩文以及其他一些语言文字,
  593. 不可能配置 Linux 终端,使其正常显示需要的字符。
  594. 这些语言的用户需要安装 X 窗口系统、能够覆盖需要的字符的字体,
  595. 以及合适的输入法(如 SCIM 支持许多语言的输入)。</para>
  596. </listitem>
  597. </itemizedlist>
  598. <!-- Added because folks keep posting their console file with X questions
  599. to blfs-support list -->
  600. <note>
  601. <!--para>The <filename>/etc/sysconfig/console</filename> file only controls
  602. the Linux text console localization. It has nothing to do with setting
  603. the proper keyboard layout and terminal fonts in the X Window System, with
  604. ssh sessions or with a serial console. In such situations, limitations
  605. mentioned in the last two list items above do not apply.</para-->
  606. <para><filename>/etc/sysconfig/console</filename> 文件只控制 Linux
  607. 字符终端的本地化,它和 X 窗口系统、ssh 连接、
  608. 串口等其他终端中的键盘布局设置和终端字体毫无关系。在这些情况下,
  609. 不存在上面描述的两项限制。</para>
  610. </note>
  611. </sect2>
  612. <sect2 id="ch-scripts-createfiles">
  613. <title>在引导时创建文件</title>
  614. <indexterm zone="ch-scripts-createfiles">
  615. <primary sortas="d-createfiles">File creation at boot</primary>
  616. <secondary>configuring</secondary>
  617. </indexterm>
  618. <!--para>At times, it is desired to create files at boot time. For instance,
  619. the <filename class="directory">/tmp/.ICE-unix</filename> directory
  620. may be desired. This can be done by creating an entry in the
  621. <filename>/etc/sysconfig/createfiles</filename> configuration script.
  622. The format of this file is embedded in the comments of the default
  623. configuration file.</para-->
  624. <para>有时,我们希望在引导时创建一些文件,例如
  625. <filename class="directory">/tmp/ICE-unix</filename> 目录。
  626. 为此,可以在 <filename>/etc/sysconfig/createfiles</filename>
  627. 配置脚本中创建一项,该文件的格式包含在默认配置文件的注释中。</para>
  628. </sect2>
  629. <sect2 id="ch-scripts-sysklogd">
  630. <title>配置 sysklogd 脚本</title>
  631. <indexterm zone="ch-scripts-sysklogd">
  632. <primary sortas="d-sysklogd">sysklogd</primary>
  633. <secondary>configuring</secondary>
  634. </indexterm>
  635. <!--para>The <filename>sysklogd</filename> script invokes the
  636. <command>syslogd</command> program as a part of System V initialization. The
  637. <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
  638. <command>syslogd</command> writes to the log files every 20 minutes by
  639. default. If you want to turn on this periodic timestamp mark, edit
  640. <filename>/etc/sysconfig/rc.site</filename> and define the variable
  641. SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
  642. set the variable to a null value:</para-->
  643. <para><filename>sysklogd</filename> 脚本启动
  644. <command>syslogd</command> 程序,它是 System V 初始化的一部分。
  645. <parameter>-m 0</parameter> 选项关闭 <command>sysklogd</command>
  646. 每 20 分钟写入日志文件的周期性时间戳,如果您希望启用该时间戳,
  647. 编辑 <filename>/etc/sysconfig/rc.site</filename>,
  648. 将 SYSKLOGD_PARMS 定义为您希望的值。例如,如果要删除所有参数,
  649. 将该变量设定为空:</para>
  650. <screen role="nodump">SYSKLOGD_PARMS=</screen>
  651. <para>参阅 <userinput>man syslogd</userinput> 了解更多可用选项。</para>
  652. </sect2>
  653. <sect2 id="ch-scripts-site">
  654. <title>rc.site 文件</title>
  655. <indexterm zone="ch-scripts-site">
  656. <primary sortas="a-rc.site">rc.site</primary>
  657. </indexterm>
  658. <!--para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
  659. settings that are automatically set for each SystemV boot script. It can
  660. alternatively set the values specified in the <filename>hostname</filename>,
  661. <filename>console</filename>, and <filename>clock</filename> files in the
  662. <filename class='directory'>/etc/sysconfig/</filename> directory. If the
  663. associated variables are present in both these separate files and
  664. <filename>rc.site</filename>, the values in the script specific files have
  665. precedence. </para-->
  666. <para>可选的 <filename>/etc/sysconfig/rc.site</filename>
  667. 文件包含为每个 System V 启动脚本自动设定的设置。
  668. <filename class="directory">/etc/sysconfig/</filename>
  669. 目录中 <filename>hostname</filename>、<filename>console</filename>
  670. 以及 <filename>clock</filename> 文件的变量值也可以在
  671. <filename>rc.site</filename> 中设置。
  672. 如果某个变量存在于这三个文件当中,它们会覆盖
  673. <filename>rc.site</filename> 中的设定。</para>
  674. <!--para><filename>rc.site</filename> also contains parameters that can
  675. customize other aspects of the boot process. Setting the IPROMPT variable
  676. will enable selective running of bootscripts. Other options are described
  677. in the file comments. The default version of the file is as follows:</para-->
  678. <para><filename>rc.site</filename>
  679. 还包含用于自定义引导过程其他属性的变量。
  680. 设定 IPROMPT 变量会启用引导脚本的选择性执行,
  681. 其他选项在文件注释中有描述。该文件的默认版本如下:</para>
  682. <!-- Use role to fix a pdf generation problem -->
  683. <screen role="auto">&site;</screen>
  684. <sect3>
  685. <title>自定义开关机脚本</title>
  686. <!--para>The LFS boot scripts boot and shut down a system in a fairly
  687. efficient manner, but there are a few tweaks that you can make in the
  688. rc.site file to improve speed even more and to adjust messages according
  689. to your preferences. To do this, adjust the settings in
  690. the <filename>/etc/sysconfig/rc.site</filename> file above.</para-->
  691. <para>LFS 启动脚本能够较为高效地引导和关闭系统,
  692. 但您仍然可以进行一些调整,进一步提高速度,
  693. 并根据您的喜好修改屏幕显示的消息。为此,需要修改上面给出的
  694. <filename>/etc/sysconfig/rc.site</filename> 文件。</para>
  695. <itemizedlist>
  696. <!--listitem><para>During the boot script <filename>udev</filename>, there is
  697. a call to <command>udev settle</command> that requires some time to
  698. complete. This time may or may not be required depending on devices present
  699. in the system. If you only have simple partitions and a single ethernet
  700. card, the boot process will probably not need to wait for this command. To
  701. skip it, set the variable OMIT_UDEV_SETTLE=y.</para></listitem-->
  702. <listitem><para>在启动脚本 <filename>udev</filename>
  703. 的运行过程中,它执行 <command>udev settle</command> 命令,
  704. 该命令需要较长时间才能完成。然而这个执行时间或许不是必要的,
  705. 如果您只有简单分区,且仅有一块网卡,
  706. 那么引导过程可能不需要等待该命令完成。设定变量
  707. OMIT_UDEV_SETTLE=y,可以跳过该命令。</para></listitem>
  708. <!--listitem><para>The boot script <filename>udev_retry</filename> also runs
  709. <command>udev settle</command> by default. This command is only needed by
  710. default if the <filename class='directory'>/var</filename> directory is
  711. separately mounted. This is because the clock needs the file
  712. <filename>/var/lib/hwclock/adjtime</filename>. Other customizations may
  713. also need to wait for udev to complete, but in many installations it is not
  714. needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y.
  715. </para></listitem-->
  716. <listitem><para>启动脚本 <filename>udev_retry</filename>
  717. 默认情况下也会执行 <command>udev settle</command>。
  718. 一般来说,该命令只有 <filename class="directory">/var</filename>
  719. 目录是一个单独的挂载点时才必要,这是因为系统时钟需要文件
  720. <filename>/var/lib/hwclock/adjtime</filename>。
  721. 其他的定制也可能导致该脚本需要等待 udev 完成,
  722. 但在绝大多数 LFS 系统中没有这个必要。
  723. 设定变量 OMIT_UDEV_RETRY_SETTLE=y 跳过这一命令。</para></listitem>
  724. <!--listitem><para>By default, the file system checks are silent. This can
  725. appear to be a delay during the bootup process. To turn on the
  726. <command>fsck</command> output, set the variable VERBOSE_FSCK=y.
  727. </para></listitem-->
  728. <listitem><para>默认情况下,文件系统检查是安静(没有输出)的。
  729. 因此,在引导过程中,检查过程可能看上去是一个很长的时延。
  730. 设置变量 VERBOSE_FSCK=y 可以打开 <command>fsck</command> 的输出。
  731. </para></listitem>
  732. <!--listitem><para>When rebooting, you may want to skip the filesystem check,
  733. <command>fsck</command>, completely. To do this, either create the file
  734. <filename>/fastboot</filename> or reboot the system with the command
  735. <command>/sbin/shutdown -f -r now</command>. On the other hand, you can
  736. force all file systems to be checked by creating
  737. <filename>/forcefsck</filename> or running <command>shutdown</command> with
  738. the <parameter>-F</parameter> parameter instead of <parameter>-f</parameter>.
  739. </para-->
  740. <listitem><para>在重启系统时,您可能希望完全跳过文件系统检查命令
  741. <command>fsck</command>。为此,可以创建文件
  742. <filename>/fastboot</filename>,或使用命令
  743. <command>/sbin/shutdown -f -r now</command> 重启系统。
  744. 另一方面,您可以创建 <filename>/forcefsck</filename> 文件,
  745. 或使用 <parameter>-F</parameter> 参数(而不是
  746. <parameter>-f</parameter>)运行 <command>shutdown</command>,
  747. 在重启系统时强制检查所有文件系统。</para>
  748. <!--para>Setting the variable FASTBOOT=y will disable <command>fsck</command>
  749. during the boot process until it is removed. This is not recommended
  750. on a permanent basis.</para></listitem-->
  751. <para>设定变量 FASTBOOT=y 会完全禁止引导过程中 <command>fsck</command>
  752. 的执行,直到该变量被删除。不建议永久使用该变量。</para></listitem>
  753. <!--listitem><para>Normally, all files in the <filename
  754. class='directory'>/tmp</filename> directory are deleted at boot time.
  755. Depending on the number of files or directories present, this can cause a
  756. noticeable delay in the boot process. To skip removing these files set the
  757. variable SKIPTMPCLEAN=y.</para></listitem-->
  758. <listitem><para>正常情况下,
  759. <filename class="directory">/tmp</filename>
  760. 中的所有文件在引导时都被删除。如果其中的文件和目录较多,
  761. 可能在引导过程中造成可观的延迟。设定变量 SKIPTMPCLEAN=y
  762. 可以跳过删除这些文件的过程。</para></listitem>
  763. <!--listitem><para>During shutdown, the <command>init</command> program sends
  764. a TERM signal to each program it has started (e.g. agetty), waits for a set
  765. time (default 3 seconds), and sends each process a KILL signal and waits
  766. again. This process is repeated in the <command>sendsignals</command>
  767. script for any processes that are not shut down by their own scripts. The
  768. delay for <command>init</command> can be set by passing a parameter. For
  769. example to remove the delay in <command>init</command>, pass the -t0
  770. parameter when shutting down or rebooting (e.g. <command>/sbin/shutdown
  771. -t0 -r now</command>). The delay for the <command>sendsignals</command>
  772. script can be skipped by setting the parameter
  773. KILLDELAY=0.</para></listitem-->
  774. <listitem><para>在系统关闭的过程中,<command>init</command>
  775. 向它启动的所有程序(如 getty)发送一个 TERM 信号,等待一段时间
  776. (默认 3 秒),再向每个进程发送 KILL 信号,之后再次等待。
  777. 在 <command>sendsignals</command> 脚本中,
  778. 以上过程会对那些没有被自己的引导脚本关闭的进程再次执行。
  779. <command>init</command> 的时延可以通过传递参数设定,
  780. 为了完全取消时延,可以在关闭或重启系统时使用 -t0 参数
  781. (如 <command>shutdown -t0 -r now</command>)。
  782. <command>sendsignals</command> 脚本的时延可以通过设定参数
  783. KILLDELAY=0 跳过。</para></listitem>
  784. </itemizedlist>
  785. </sect3>
  786. </sect2>
  787. </sect1>