source: chapter07/usage.xml@ 6be8f06

Last change on this file since 6be8f06 was a811dff0, checked in by Matthew Burgess <matthew@…>, 20 years ago
  • (chapter07/*.xml) RELAX NG validation fixes

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

  • Property mode set to 100644
File size: 4.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE section [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<section xmlns="http://docbook.org/docbook-ng"
7 xml:id="ch-scripts-usage">
8<info><title>How do these bootscripts work?</title></info>
9<?dbhtml filename="usage.html"?>
10
11<indexterm zone="ch-scripts-usage">
12<primary sortas="a-Bootscripts">Bootscripts</primary>
13<secondary>usage</secondary></indexterm>
14
15<para>Linux uses a special booting facility named SysVinit. It's based on a
16concept of <emphasis>run-levels</emphasis>. It can be widely different
17from one system to another, so it can't be assumed that because things
18worked in &lt;insert distro name&gt; they should work like that in LFS
19too. LFS has its own way of doing things, but it respects generally
20accepted standards.</para>
21
22<para>SysVinit (which we'll call <emphasis>init</emphasis> from now on) works
23using a run-levels scheme. There are 7 (from 0 to 6) run-levels
24(actually, there are more run-levels but they are for special cases and
25generally not used. The <command>init</command> man page describes those details), and each
26one of those corresponds to the things the computer is supposed to do when
27it starts up. The default run-level is 3. Here are the descriptions of the
28different run-levels as they are often implemented:</para>
29
30<literallayout>0: halt the computer
311: single-user mode
322: multi-user mode without networking
333: multi-user mode with networking
344: reserved for customization, otherwise does the same as 3
355: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm)
366: reboot the computer</literallayout>
37
38<para>The command used to change run-levels is <command>init
39&lt;runlevel&gt;</command> where &lt;runlevel&gt; is the target run-level. For
40example, to reboot the computer, a user would issue the <userinput>init
416</userinput> command. The <command>reboot</command> command is just an alias for
42it, as is the <command>halt</command> command an alias for <command>init
430</command>.</para>
44
45<para>There are a number of directories under <filename class="directory">/etc/rc.d</filename>
46that look like like <filename class="directory">rc?.d</filename> (where ? is the
47number of the run-level) and <filename class="directory">rcsysinit.d</filename>
48all containing a number of symbolic links. Some begin with a K, the others begin
49with an S, and all of them have two numbers following the initial letter. The K
50means to stop (kill) a service, and the S means to start a service. The numbers
51determine the order in which the scripts are run, from 00 to 99; the lower the
52number the sooner it gets executed. When init switches to another run-level, the
53appropriate services get killed and others get started.</para>
54
55<para>The real scripts are in <filename class="directory">/etc/rc.d/init.d</filename>.
56They do all the work, and the symlinks all point to them. Killing links and starting links
57point to the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
58That's because the scripts can be called with different parameters like
59<parameter>start</parameter>, <parameter>stop</parameter>,
60<parameter>restart</parameter>, <parameter>reload</parameter>,
61<parameter>status</parameter>. When a K link is encountered, the appropriate
62script is run with the <parameter>stop</parameter> argument. When an S link is
63encountered, the appropriate script is run with the <parameter>start</parameter>
64argument.</para>
65
66<para>There is one exception. Links that start with an S in the
67rc0.d and rc6.d directories will not cause anything to be started. They
68will be called with the parameter <parameter>stop</parameter> to stop
69something. The logic behind it is that when you are going to reboot or
70halt the system, you don't want to start anything, only stop the
71system.</para>
72
73<para>These are descriptions of what the arguments make the
74scripts do:</para>
75
76<variablelist>
77<varlistentry>
78<term><parameter>start</parameter></term>
79<listitem><para>The service is started.</para></listitem>
80</varlistentry>
81
82<varlistentry>
83<term><parameter>stop</parameter></term>
84<listitem><para>The service is stopped.</para></listitem>
85</varlistentry>
86
87<varlistentry>
88<term><parameter>restart</parameter></term>
89<listitem><para>The service is stopped and then started again.</para></listitem>
90</varlistentry>
91
92<varlistentry>
93<term><parameter>reload</parameter></term>
94<listitem><para>The configuration of the service is updated.
95This is used after the configuration file of a service was modified, when
96the service doesn't need to be restarted.</para></listitem>
97</varlistentry>
98
99<varlistentry>
100<term><parameter>status</parameter></term>
101<listitem><para>Tells if the service is running and with which PIDs.</para></listitem>
102</varlistentry>
103</variablelist>
104
105<para>Feel free to modify the way the boot process works (after all, it's your
106own LFS system). The files given here are just an example of how it can be
107done in a nice way (well, what we consider nice -- you may hate it).</para>
108
109</section>
Note: See TracBrowser for help on using the repository browser.