Ignore:
Timestamp:
01/06/2006 02:59:05 AM (19 years ago)
Author:
Jeremy Huntwork <jhuntwork@…>
Children:
e1ca33a
Parents:
1714f1a
Message:

Merged recent changes from trunk to lfs-alpha. Fixed typo.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/alphabetical/BOOK@7248 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/usage.xml

    r1714f1a r46a2e9c  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
     2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
     3  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
    34  <!ENTITY % general-entities SYSTEM "../general.ent">
    45  %general-entities;
    56]>
     7
    68<sect1 id="ch-scripts-usage">
    7 <title>How Do These Bootscripts Work?</title>
    8 <?dbhtml filename="usage.html"?>
     9  <?dbhtml filename="usage.html"?>
    910
    10 <indexterm zone="ch-scripts-usage">
    11 <primary sortas="a-Bootscripts">Bootscripts</primary>
    12 <secondary>usage</secondary></indexterm>
     11  <title>How Do These Bootscripts Work?</title>
    1312
    14 <para>Linux uses a special booting facility named SysVinit that is based on a
    15 concept of <emphasis>run-levels</emphasis>. It can be quite different from one
    16 system to another, so it cannot be assumed that because things worked in one
    17 particular Linux distribution, they should work the same in LFS too. LFS has its
    18 own way of doing things, but it respects generally accepted standards.</para>
     13  <indexterm zone="ch-scripts-usage">
     14    <primary sortas="a-Bootscripts">Bootscripts</primary>
     15    <secondary>usage</secondary>
     16  </indexterm>
    1917
    20 <para>SysVinit (which will be referred to as <quote>init</quote> from now on)
    21 works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
    22 (actually, there are more run-levels, but they are for special cases and are
    23 generally not used. See <filename>init(8)</filename> for more details), and each one
    24 of those corresponds to the actions the computer is supposed to perform when it
    25 starts up. The default run-level is 3. Here are the descriptions of the
    26 different run-levels as they are implemented:</para>
     18  <para>Linux uses a special booting facility named SysVinit that is based on a
     19  concept of <emphasis>run-levels</emphasis>. It can be quite different from one
     20  system to another, so it cannot be assumed that because things worked in one
     21  particular Linux distribution, they should work the same in LFS too. LFS has its
     22  own way of doing things, but it respects generally accepted standards.</para>
     23
     24  <para>SysVinit (which will be referred to as <quote>init</quote> from now on)
     25  works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels
     26  (actually, there are more run-levels, but they are for special cases and are
     27  generally not used. See <filename>init(8)</filename> for more details), and
     28  each one of those corresponds to the actions the computer is supposed to
     29  perform when it starts up. The default run-level is 3. Here are the
     30  descriptions of the different run-levels as they are implemented:</para>
    2731
    2832<literallayout>0: halt the computer
     
    34386: reboot the computer</literallayout>
    3539
    36 <para>The command used to change run-levels is <command>init
    37 <replaceable>[runlevel]</replaceable></command>, where
    38 <replaceable>[runlevel]</replaceable> is the target run-level. For example, to
    39 reboot the computer, a user could issue the <command>init 6</command> command,
    40 which is an alias for the <command>reboot</command> command. Likewise,
    41 <command>init 0</command> is an alias for the <command>halt</command>
    42 command.</para>
     40  <para>The command used to change run-levels is <command>init
     41  <replaceable>[runlevel]</replaceable></command>, where
     42  <replaceable>[runlevel]</replaceable> is the target run-level. For example, to
     43  reboot the computer, a user could issue the <command>init 6</command> command,
     44  which is an alias for the <command>reboot</command> command. Likewise,
     45  <command>init 0</command> is an alias for the <command>halt</command>
     46  command.</para>
    4347
    44 <para>There are a number of directories under <filename
    45 class="directory">/etc/rc.d</filename> that look like <filename
    46 class="directory">rc?.d</filename> (where ? is the number of the run-level) and
    47 <filename class="directory">rcsysinit.d</filename>, all containing a number of
    48 symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
    49 an <emphasis>S</emphasis>, and all of them have two numbers following the
    50 initial letter. The K means to stop (kill) a service and the S means to start a
    51 service. The numbers determine the order in which the scripts are run, from 00
    52 to 99&mdash;the lower the number the earlier it gets executed. When
    53 <command>init</command> switches to another run-level, the appropriate services
    54 are either started or stopped, depending on the runlevel chosen.</para>
     48  <para>There are a number of directories under <filename
     49  class="directory">/etc/rc.d</filename> that look like <filename
     50  class="directory">rc?.d</filename> (where ? is the number of the run-level) and
     51  <filename class="directory">rcsysinit.d</filename>, all containing a number of
     52  symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
     53  an <emphasis>S</emphasis>, and all of them have two numbers following the
     54  initial letter. The K means to stop (kill) a service and the S means to start a
     55  service. The numbers determine the order in which the scripts are run, from 00
     56  to 99&mdash;the lower the number the earlier it gets executed. When
     57  <command>init</command> switches to another run-level, the appropriate services
     58  are either started or stopped, depending on the runlevel chosen.</para>
    5559
    56 <para>The real scripts are in <filename
    57 class="directory">/etc/rc.d/init.d</filename>. They do the actual
    58 work, and the symlinks all point to them. Killing links and starting
    59 links point to the same script in <filename
    60 class="directory">/etc/rc.d/init.d</filename>. This is because the
    61 scripts can be called with different parameters like
    62 <parameter>start</parameter>, <parameter>stop</parameter>,
    63 <parameter>restart</parameter>, <parameter>reload</parameter>, and
    64 <parameter>status</parameter>. When a K link is encountered, the
    65 appropriate script is run with the <parameter>stop</parameter>
    66 argument. When an S link is encountered, the appropriate script is run
    67 with the <parameter>start</parameter> argument.</para>
     60  <para>The real scripts are in <filename
     61  class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
     62  the symlinks all point to them. Killing links and starting links point to
     63  the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
     64  This is because the scripts can be called with different parameters like
     65  <parameter>start</parameter>, <parameter>stop</parameter>,
     66  <parameter>restart</parameter>, <parameter>reload</parameter>, and
     67  <parameter>status</parameter>. When a K link is encountered, the appropriate
     68  script is run with the <parameter>stop</parameter> argument. When an S link
     69  is encountered, the appropriate script is run with the
     70  <parameter>start</parameter> argument.</para>
    6871
    69 <para>There is one exception to this explanation. Links that start
    70 with an <emphasis>S</emphasis> in the <filename
    71 class="directory">rc0.d</filename> and <filename
    72 class="directory">rc6.d</filename> directories will not cause anything
    73 to be started. They will be called with the parameter
    74 <parameter>stop</parameter> to stop something. The logic behind this
    75 is that when a user is going to reboot or halt the system, nothing
    76 needs to be started.  The system only needs to be stopped.</para>
     72  <para>There is one exception to this explanation. Links that start
     73  with an <emphasis>S</emphasis> in the <filename
     74  class="directory">rc0.d</filename> and <filename
     75  class="directory">rc6.d</filename> directories will not cause anything
     76  to be started. They will be called with the parameter
     77  <parameter>stop</parameter> to stop something. The logic behind this
     78  is that when a user is going to reboot or halt the system, nothing
     79  needs to be started.  The system only needs to be stopped.</para>
    7780
    78 <para>These are descriptions of what the arguments make the scripts
    79 do:</para>
     81  <para>These are descriptions of what the arguments make the scripts
     82  do:</para>
    8083
    81 <variablelist>
    82 <varlistentry>
    83 <term><parameter>start</parameter></term>
    84 <listitem><para>The service is started.</para></listitem>
    85 </varlistentry>
     84  <variablelist>
    8685
    87 <varlistentry>
    88 <term><parameter>stop</parameter></term>
    89 <listitem><para>The service is stopped.</para></listitem>
    90 </varlistentry>
     86    <varlistentry>
     87      <term><parameter>start</parameter></term>
     88      <listitem>
     89        <para>The service is started.</para>
     90      </listitem>
     91    </varlistentry>
    9192
    92 <varlistentry>
    93 <term><parameter>restart</parameter></term>
    94 <listitem><para>The service is stopped and then started again.</para></listitem>
    95 </varlistentry>
     93    <varlistentry>
     94      <term><parameter>stop</parameter></term>
     95      <listitem>
     96        <para>The service is stopped.</para>
     97      </listitem>
     98    </varlistentry>
    9699
    97 <varlistentry>
    98 <term><parameter>reload</parameter></term>
    99 <listitem><para>The configuration of the service is updated.
    100 This is used after the configuration file of a service was modified, when
    101 the service does not need to be restarted.</para></listitem>
    102 </varlistentry>
     100    <varlistentry>
     101      <term><parameter>restart</parameter></term>
     102      <listitem>
     103        <para>The service is stopped and then started again.</para>
     104      </listitem>
     105    </varlistentry>
    103106
    104 <varlistentry>
    105 <term><parameter>status</parameter></term>
    106 <listitem><para>Tells if the service is running and with which PIDs.</para></listitem>
    107 </varlistentry>
    108 </variablelist>
     107    <varlistentry>
     108      <term><parameter>reload</parameter></term>
     109      <listitem>
     110        <para>The configuration of the service is updated.
     111        This is used after the configuration file of a service was modified, when
     112        the service does not need to be restarted.</para>
     113      </listitem>
     114    </varlistentry>
    109115
    110 <para>Feel free to modify the way the boot process works (after all,
    111 it is your own LFS system). The files given here are an example of how
    112 it can be done.</para>
     116    <varlistentry>
     117      <term><parameter>status</parameter></term>
     118      <listitem>
     119        <para>Tells if the service is running and with which PIDs.</para>
     120      </listitem>
     121    </varlistentry>
     122
     123  </variablelist>
     124
     125  <para>Feel free to modify the way the boot process works (after all,
     126  it is your own LFS system). The files given here are an example of how
     127  it can be done.</para>
    113128
    114129</sect1>
    115 
Note: See TracChangeset for help on using the changeset viewer.