| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 | <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [  <!ENTITY % general-entities SYSTEM "../general.ent">  %general-entities;]><sect1 id="ch-system-sysvinit" role="wrap" revision="sysv">  <?dbhtml filename="sysvinit.html"?>  <sect1info condition="script">    <productname>sysvinit</productname>    <productnumber>&sysvinit-version;</productnumber>    <address>&sysvinit-url;</address>  </sect1info>  <title>Sysvinit-&sysvinit-version;</title>  <indexterm zone="ch-system-sysvinit">    <primary sortas="a-Sysvinit">Sysvinit</primary>  </indexterm>  <sect2 role="package">    <title/>    <para>Sysvinit 软件包包含控制系统启动、运行和关闭的程序。</para>    <segmentedlist>      <segtitle>&buildtime;</segtitle>      <segtitle>&diskspace;</segtitle>      <seglistitem>        <seg>&sysvinit-ch6-sbu;</seg>        <seg>&sysvinit-ch6-du;</seg>      </seglistitem>    </segmentedlist>  </sect2>  <sect2 role="installation">    <title>安装 Sysvinit</title><!--    <para>When run-levels are changed (for example, when halting the    system), <command>init</command> sends termination signals to those    processes that <command>init</command> itself started and that should    not be running in the new run-level.  While doing this,    <command>init</command> outputs messages like <quote>Sending processes    the TERM signal</quote> which seem to imply that it is sending these    signals to all currently running processes. To avoid this    misinterpretation, modify the source so that these messages read like    <quote>Sending processes configured via /etc/inittab the TERM signal</quote>    instead:</para><screen><userinput remap="pre">sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c</userinput></screen>    <para>Maintained versions of the <command>wall</command>,    <command>mountpoint</command>, <command>last</command>,    <command>mesg</command>, <command>sulogin</command>, and    <command>utmpdump</command> programs were installed earlier by Util-linux.    Suppress the installation of Sysvinit's versions of these programs and    their man pages:</para><screen><userinput remap="make">sed -ri -e '/utmpdump/d'   \        -e '/mountpoint/d' \        -e '/mesg/d'       \        -e 's/= sulogin(\.8)?/=/' src/Makefile</userinput></screen>-->    <para>首先,应用一个补丁,它会删除 sysvinit 中其他软件包已经安装的程序,    使一条消息更加清晰,并修复一个引发编译器警告的问题:</para><screen><userinput remap="pre">patch -Np1 -i ../&sysvinit-consolidated-patch;</userinput></screen>    <para>编译该软件包:</para><screen><userinput remap="make">make -C src</userinput></screen>    <para>该软件包不包含测试套件。</para>    <para>安装该软件包:</para><screen><userinput remap="install">make -C src install</userinput></screen>  </sect2>  <sect2 id="contents-sysvinit" role="content">    <title>Sysvinit 的内容</title>    <segmentedlist>      <segtitle>安装的程序</segtitle>      <seglistitem>        <seg>bootlogd, fstab-decode, halt, init, killall5,         poweroff (到 halt 的链接), reboot (到 halt 的链接), runlevel,        shutdown, 以及 telinit (到 init 的链接)</seg>      </seglistitem>    </segmentedlist>    <variablelist>      <bridgehead renderas="sect3">简要描述</bridgehead>      <?dbfo list-presentation="list"?>      <?dbhtml list-presentation="table"?>      <varlistentry id="bootlogd">        <term><command>bootlogd</command></term>        <listitem>          <para>将引导消息写入日志文件</para>          <indexterm zone="ch-system-sysvinit bootlogd">            <primary sortas="b-bootlogd">bootlogd</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="fstab-decode">        <term><command>fstab-decode</command></term>        <listitem>          <para>以 fstab 编码的参数运行命令</para>          <indexterm zone="ch-system-sysvinit fstab-decode">            <primary sortas="b-fstab-decode">fstab-decode</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="halt-sysv">        <term><command>halt</command></term>        <listitem>          <para>通常以 <parameter>-h</parameter> 参数调用          <command>shutdown</command>,除非已经处于运行级别 0,          这样它会通知内核停止系统运行;在系统被关闭时,它在          <filename>/var/log/wtmp</filename> 文件中进行记录</para>          <indexterm zone="ch-system-sysvinit halt-sysv">            <primary sortas="b-halt">halt</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="init-sysv">        <term><command>init</command></term>        <listitem>          <para>内核初始化硬件后启动的第一个进程,它接管引导过程,          启动其配置文件中指定的所有进程</para>          <indexterm zone="ch-system-sysvinit init-sysv">            <primary sortas="b-init">init</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="killall5">        <term><command>killall5</command></term>        <listitem>          <para>向除了自身会话中以外的所有进程发送信号,          杀死多数进程,但不会杀死作为它本身父进程的 shell</para>          <indexterm zone="ch-system-sysvinit killall5">            <primary sortas="b-killall5">killall5</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="poweroff-sysv">        <term><command>poweroff</command></term>        <listitem>          <para>告诉内核停止系统运行并关闭电源          (参阅 <command>halt</command>)</para>          <indexterm zone="ch-system-sysvinit poweroff-sysv">            <primary sortas="b-poweroff">poweroff</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="reboot-sysv">        <term><command>reboot</command></term>        <listitem>          <para>告诉内核重启系统 (参阅          <command>halt</command>)</para>          <indexterm zone="ch-system-sysvinit reboot-sysv">            <primary sortas="b-reboot">reboot</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="runlevel-sysv">        <term><command>runlevel</command></term>        <listitem>          <para>报告上一次的和当前的系统运行级别,          上一次系统运行级别记录在 <filename>/var/run/utmp</filename>		  中</para>          <indexterm zone="ch-system-sysvinit runlevel-sysv">            <primary sortas="b-runlevel">runlevel</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="shutdown-sysv">        <term><command>shutdown</command></term>        <listitem>          <para>安全地将系统下线,向所有进程发送信号,并通知所有登录用户          </para>          <indexterm zone="ch-system-sysvinit shutdown-sysv">            <primary sortas="b-shutdown">shutdown</primary>          </indexterm>        </listitem>      </varlistentry>      <varlistentry id="telinit-sysv">        <term><command>telinit</command></term>        <listitem>          <para>告诉 <command>init</command> 切换到哪个运行级别</para>          <indexterm zone="ch-system-sysvinit telinit-sysv">            <primary sortas="b-telinit">telinit</primary>          </indexterm>        </listitem>      </varlistentry>    </variablelist>  </sect2></sect1>
 |