source: BOOK/bootscripts/common/usage.xml@ 8f83277

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 8f83277 was 6cc3c3f, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Add a note to the usage page to completly disregard it until
it can be re-written to show how systemd controls services.

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