source: BOOK/bootscripts/common/usage.xml@ 421e729

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 421e729 was aa18ac0, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Updated trunk book sources to use DocBook-XML DTD 4.5.

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