source: chapter07/usage.xml@ faca37e

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since faca37e was faca37e, checked in by Archaic <archaic@…>, 19 years ago

Several minor wording changes in chapter 8 (matt).

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

  • Property mode set to 100644
File size: 5.2 KB
Line 
1<?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" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<sect1 id="ch-scripts-usage">
7<title>How Do These Bootscripts Work?</title>
8<?dbhtml filename="usage.html"?>
9
10<indexterm zone="ch-scripts-usage">
11<primary sortas="a-Bootscripts">Bootscripts</primary>
12<secondary>usage</secondary></indexterm>
13
14<para>Linux uses a special booting facility named SysVinit that is based on a
15concept of <emphasis>run-levels</emphasis>. It can be quite different from one
16system to another, so it cannot be assumed that because things worked in one
17particular Linux distribution, they should work the same in LFS too. LFS has its
18own way of doing things, but it respects generally accepted standards.</para>
19
20<para>SysVinit (which will be referred to as <quote>init</quote> from now on)
21works using a run-levels scheme. There are seven (from 0 to 6) run-levels
22(actually, there are more run-levels, but they are for special cases and are
23generally not used. The init manual page describes those details), and each one
24of those corresponds to the actions the computer is supposed to perform when it
25starts up. The default run-level is 3. Here are the descriptions of the
26different run-levels as they are implemented:</para>
27
28<literallayout>0: halt the computer
291: single-user mode
302: multi-user mode without networking
313: multi-user mode with networking
324: reserved for customization, otherwise does the same as 3
335: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>)
346: reboot the computer</literallayout>
35
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
39reboot the computer, a user could issue the <command>init 6</command> command,
40which is an alias for the <command>reboot</command> command. Likewise,
41<command>init 0</command> is an alias for the <command>halt</command>
42command.</para>
43
44<para>There are a number of directories under <filename
45class="directory">/etc/rc.d</filename> that look like <filename
46class="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
48symbolic links. Some begin with a <emphasis>K</emphasis>, the others begin with
49an <emphasis>S</emphasis>, and all of them have two numbers following the
50initial letter. The K means to stop (kill) a service and the S means to start a
51service. The numbers determine the order in which the scripts are run, from 00
52to 99&mdash;the lower the number the earlier it gets executed. When
53<command>init</command> switches to another run-level, the appropriate services
54are either started or stopped, depending on the runlevel chosen.</para>
55
56<para>The real scripts are in <filename
57class="directory">/etc/rc.d/init.d</filename>. They do the actual
58work, and the symlinks all point to them. Killing links and starting
59links point to the same script in <filename
60class="directory">/etc/rc.d/init.d</filename>. This is because the
61scripts 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
65appropriate script is run with the <parameter>stop</parameter>
66argument. When an S link is encountered, the appropriate script is run
67with the <parameter>start</parameter> argument.</para>
68
69<para>There is one exception to this explanation. Links that start
70with an <emphasis>S</emphasis> in the <filename
71class="directory">rc0.d</filename> and <filename
72class="directory">rc6.d</filename> directories will not cause anything
73to be started. They will be called with the parameter
74<parameter>stop</parameter> to stop something. The logic behind this
75is that when a user is going to reboot or halt the system, nothing
76needs to be started. The system only needs to be stopped.</para>
77
78<para>These are descriptions of what the arguments make the scripts
79do:</para>
80
81<variablelist>
82<varlistentry>
83<term><parameter>start</parameter></term>
84<listitem><para>The service is started.</para></listitem>
85</varlistentry>
86
87<varlistentry>
88<term><parameter>stop</parameter></term>
89<listitem><para>The service is stopped.</para></listitem>
90</varlistentry>
91
92<varlistentry>
93<term><parameter>restart</parameter></term>
94<listitem><para>The service is stopped and then started again.</para></listitem>
95</varlistentry>
96
97<varlistentry>
98<term><parameter>reload</parameter></term>
99<listitem><para>The configuration of the service is updated.
100This is used after the configuration file of a service was modified, when
101the service does not need to be restarted.</para></listitem>
102</varlistentry>
103
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>
109
110<para>Feel free to modify the way the boot process works (after all,
111it is your own LFS system). The files given here are an example of how
112it can be done.</para>
113
114</sect1>
115
Note: See TracBrowser for help on using the repository browser.