[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[a001133] | 6 | <sect1 id="ch-system-sysvinit" xreflabel="Sysvinit" role="wrap">
|
---|
[673b0d8] | 7 | <title>Sysvinit-&sysvinit-version;</title>
|
---|
| 8 | <?dbhtml filename="sysvinit.html"?>
|
---|
| 9 |
|
---|
| 10 | <indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm>
|
---|
[6370fa6] | 11 |
|
---|
[a001133] | 12 | <sect2 role="package"><title/>
|
---|
[5888299] | 13 | <para>The Sysvinit package contains programs for controlling the startup,
|
---|
| 14 | running, and shutdown of your system.</para>
|
---|
| 15 |
|
---|
[a001133] | 16 | <segmentedlist>
|
---|
| 17 | <segtitle>&buildtime;</segtitle>
|
---|
| 18 | <segtitle>&diskspace;</segtitle>
|
---|
| 19 | <seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem>
|
---|
| 20 | </segmentedlist>
|
---|
[673b0d8] | 21 |
|
---|
[a001133] | 22 | <segmentedlist>
|
---|
| 23 | <segtitle>Sysvinit installation depends on</segtitle>
|
---|
| 24 | <seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make</seg></seglistitem>
|
---|
| 25 | </segmentedlist>
|
---|
| 26 | </sect2>
|
---|
[3554fa3a] | 27 |
|
---|
[a001133] | 28 | <sect2 role="installation">
|
---|
[73aedd1d] | 29 | <title>Installation of Sysvinit</title>
|
---|
| 30 |
|
---|
[673b0d8] | 31 | <para>When run-levels are changed (for example, when halting the system),
|
---|
| 32 | <command>init</command> sends termination signals to those processes that
|
---|
| 33 | <command>init</command> itself started and that shouldn't be running in the new
|
---|
| 34 | run-level. While doing this, <command>init</command> outputs messages like
|
---|
| 35 | <quote>Sending processes the TERM signal</quote> which seem to imply that it is sending these signals to all currently running processes. To avoid this
|
---|
| 36 | misinterpretation, you can modify the source so that these messages read like
|
---|
| 37 | <quote>Sending processes started by init the TERM signal</quote> instead:</para>
|
---|
[73aedd1d] | 38 |
|
---|
[2ec4b60] | 39 | <screen><userinput>sed -i 's@Sending processes@& started by init@g' \
|
---|
| 40 | src/init.c</userinput></screen>
|
---|
[73aedd1d] | 41 |
|
---|
| 42 | <para>Compile Sysvinit:</para>
|
---|
| 43 |
|
---|
| 44 | <screen><userinput>make -C src</userinput></screen>
|
---|
| 45 |
|
---|
[673b0d8] | 46 | <para>Then install it:</para>
|
---|
[73aedd1d] | 47 |
|
---|
| 48 | <screen><userinput>make -C src install</userinput></screen>
|
---|
| 49 |
|
---|
| 50 | </sect2>
|
---|
[5888299] | 51 |
|
---|
[342b176] | 52 |
|
---|
[df8334f] | 53 | <sect2 id="conf-sysvinit" role="configuration"><title>Configuring Sysvinit</title>
|
---|
[673b0d8] | 54 | <indexterm zone="conf-sysvinit">
|
---|
| 55 | <primary sortas="a-Sysvinit">Sysvinit</primary>
|
---|
| 56 | <secondary>configuring</secondary></indexterm>
|
---|
| 57 |
|
---|
| 58 | <indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm>
|
---|
[342b176] | 59 |
|
---|
| 60 | <para>Create a new <filename>/etc/inittab</filename> file by running the
|
---|
| 61 | following:</para>
|
---|
| 62 |
|
---|
| 63 | <screen><userinput>cat > /etc/inittab << "EOF"</userinput>
|
---|
| 64 | # Begin /etc/inittab
|
---|
| 65 |
|
---|
| 66 | id:3:initdefault:
|
---|
| 67 |
|
---|
| 68 | si::sysinit:/etc/rc.d/init.d/rc sysinit
|
---|
| 69 |
|
---|
| 70 | l0:0:wait:/etc/rc.d/init.d/rc 0
|
---|
| 71 | l1:S1:wait:/etc/rc.d/init.d/rc 1
|
---|
| 72 | l2:2:wait:/etc/rc.d/init.d/rc 2
|
---|
| 73 | l3:3:wait:/etc/rc.d/init.d/rc 3
|
---|
| 74 | l4:4:wait:/etc/rc.d/init.d/rc 4
|
---|
| 75 | l5:5:wait:/etc/rc.d/init.d/rc 5
|
---|
| 76 | l6:6:wait:/etc/rc.d/init.d/rc 6
|
---|
| 77 |
|
---|
| 78 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
|
---|
| 79 |
|
---|
| 80 | su:S016:once:/sbin/sulogin
|
---|
| 81 |
|
---|
[b32e803] | 82 | 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
|
---|
| 83 | 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
|
---|
| 84 | 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
|
---|
| 85 | 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
|
---|
| 86 | 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
|
---|
| 87 | 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
|
---|
[342b176] | 88 |
|
---|
| 89 | # End /etc/inittab
|
---|
| 90 | <userinput>EOF</userinput></screen>
|
---|
| 91 |
|
---|
[b32e803] | 92 | <para> The -I '\033(K' switch tells agetty to send this escape sequence to
|
---|
| 93 | the terminal before doing anything else. This escape sequence switches the
|
---|
| 94 | console character set to a user-defined one, which can be modified by
|
---|
| 95 | running the <command>setfont</command> program.
|
---|
| 96 | Actually, the <command>console</command> initscript from the LFS-Bootscripts
|
---|
| 97 | package calls the <command>setfont</command> program during system
|
---|
| 98 | startup. Sending this escape sequence is necessary for
|
---|
| 99 | people who use non-ISO-8859-1 screen font, but does not hurt native English
|
---|
| 100 | speakers.</para>
|
---|
| 101 |
|
---|
[342b176] | 102 | </sect2>
|
---|
[5888299] | 103 |
|
---|
| 104 |
|
---|
[c6cb3aa] | 105 | <sect2 id="contents-sysvinit" role="content"><title>Contents of Sysvinit</title>
|
---|
[673b0d8] | 106 |
|
---|
[c6cb3aa] | 107 | <segmentedlist>
|
---|
| 108 | <segtitle>Installed programs</segtitle>
|
---|
| 109 | <seglistitem><seg>halt, init, killall5, last, lastb (link to last), mesg, pidof (link to
|
---|
| 110 | killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit
|
---|
| 111 | (link to init), utmpdump and wall</seg></seglistitem>
|
---|
| 112 | </segmentedlist>
|
---|
[673b0d8] | 113 |
|
---|
[c6cb3aa] | 114 | <variablelist><title>Short descriptions</title>
|
---|
[673b0d8] | 115 |
|
---|
[b8a819f] | 116 | <varlistentry id="halt">
|
---|
| 117 | <term><command>halt</command></term>
|
---|
[c6cb3aa] | 118 | <listitem>
|
---|
[673b0d8] | 119 | <indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
|
---|
[c6cb3aa] | 120 | <para>normally invokes shutdown with the -h flag,
|
---|
[673b0d8] | 121 | except when already in run-level 0, then it tells the kernel to halt the system.
|
---|
| 122 | But first it notes in the file <filename>/var/log/wtmp</filename> that the
|
---|
| 123 | system is being brought down.</para>
|
---|
[c6cb3aa] | 124 | </listitem>
|
---|
| 125 | </varlistentry>
|
---|
[673b0d8] | 126 |
|
---|
[b8a819f] | 127 | <varlistentry id="init">
|
---|
| 128 | <term><command>init</command></term>
|
---|
[c6cb3aa] | 129 | <listitem>
|
---|
[673b0d8] | 130 | <indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
|
---|
[c6cb3aa] | 131 | <para>is the mother of all processes. It reads its
|
---|
[673b0d8] | 132 | commands from <filename>/etc/inittab</filename>, which normally tell it which
|
---|
| 133 | scripts to run for which run-level, and how many gettys to spawn.</para>
|
---|
[c6cb3aa] | 134 | </listitem>
|
---|
| 135 | </varlistentry>
|
---|
[673b0d8] | 136 |
|
---|
[b8a819f] | 137 | <varlistentry id="killall5">
|
---|
| 138 | <term><command>killall5</command></term>
|
---|
[c6cb3aa] | 139 | <listitem>
|
---|
[673b0d8] | 140 | <indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
|
---|
[c6cb3aa] | 141 | <para>sends a signal to all processes, except the processes in its own session --
|
---|
| 142 | so it won't kill the shell running the script that called it.</para>
|
---|
| 143 | </listitem>
|
---|
| 144 | </varlistentry>
|
---|
| 145 |
|
---|
[b8a819f] | 146 | <varlistentry id="last">
|
---|
| 147 | <term><command>last</command></term>
|
---|
[c6cb3aa] | 148 | <listitem>
|
---|
[673b0d8] | 149 | <indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
|
---|
[c6cb3aa] | 150 | <para>shows which users last logged in (and out),
|
---|
[673b0d8] | 151 | searching back through the file <filename>/var/log/wtmp</filename>. It can
|
---|
| 152 | also show system boots and shutdowns, and run-level changes.</para>
|
---|
[c6cb3aa] | 153 | </listitem>
|
---|
| 154 | </varlistentry>
|
---|
[673b0d8] | 155 |
|
---|
[b8a819f] | 156 | <varlistentry id="lastb">
|
---|
| 157 | <term><command>lastb</command></term>
|
---|
[c6cb3aa] | 158 | <listitem>
|
---|
[673b0d8] | 159 | <indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
|
---|
[c6cb3aa] | 160 | <para>shows the failed login attempts, as logged in
|
---|
| 161 | <filename>/var/log/btmp</filename>.</para>
|
---|
| 162 | </listitem>
|
---|
| 163 | </varlistentry>
|
---|
| 164 |
|
---|
[b8a819f] | 165 | <varlistentry id="mesg">
|
---|
| 166 | <term><command>mesg</command></term>
|
---|
[c6cb3aa] | 167 | <listitem>
|
---|
[673b0d8] | 168 | <indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
|
---|
[c6cb3aa] | 169 | <para>controls whether other users can send
|
---|
[673b0d8] | 170 | messages to the current user's terminal.</para>
|
---|
[c6cb3aa] | 171 | </listitem>
|
---|
| 172 | </varlistentry>
|
---|
[73aedd1d] | 173 |
|
---|
[b8a819f] | 174 | <varlistentry id="pidof">
|
---|
| 175 | <term><command>pidof</command></term>
|
---|
[c6cb3aa] | 176 | <listitem>
|
---|
[673b0d8] | 177 | <indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
|
---|
[c6cb3aa] | 178 | <para>reports the PIDs of the given programs.</para>
|
---|
| 179 | </listitem>
|
---|
| 180 | </varlistentry>
|
---|
[673b0d8] | 181 |
|
---|
[b8a819f] | 182 | <varlistentry id="poweroff">
|
---|
| 183 | <term><command>poweroff</command></term>
|
---|
[c6cb3aa] | 184 | <listitem>
|
---|
[673b0d8] | 185 | <indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
|
---|
[c6cb3aa] | 186 | <para>tells the kernel to halt the system and
|
---|
[673b0d8] | 187 | switch off the computer. But see halt.</para>
|
---|
[c6cb3aa] | 188 | </listitem>
|
---|
| 189 | </varlistentry>
|
---|
[673b0d8] | 190 |
|
---|
[b8a819f] | 191 | <varlistentry id="reboot">
|
---|
| 192 | <term><command>reboot</command></term>
|
---|
[c6cb3aa] | 193 | <listitem>
|
---|
[673b0d8] | 194 | <indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
|
---|
[c6cb3aa] | 195 | <para>tells the kernel to reboot the system. But see halt.</para>
|
---|
| 196 | </listitem>
|
---|
| 197 | </varlistentry>
|
---|
[673b0d8] | 198 |
|
---|
[b8a819f] | 199 | <varlistentry id="runlevel">
|
---|
| 200 | <term><command>runlevel</command></term>
|
---|
[c6cb3aa] | 201 | <listitem>
|
---|
[673b0d8] | 202 | <indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
|
---|
[c6cb3aa] | 203 | <para>reports the previous and the current run-level, as noted in the last run-level
|
---|
| 204 | record in <filename>/var/run/utmp</filename>.</para>
|
---|
| 205 | </listitem>
|
---|
| 206 | </varlistentry>
|
---|
| 207 |
|
---|
[b8a819f] | 208 | <varlistentry id="shutdown">
|
---|
| 209 | <term><command>shutdown</command></term>
|
---|
[c6cb3aa] | 210 | <listitem>
|
---|
[673b0d8] | 211 | <indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
|
---|
[c6cb3aa] | 212 | <para>brings the system down in a secure way,
|
---|
[673b0d8] | 213 | signaling all processes and notifying all logged-in users.</para>
|
---|
[c6cb3aa] | 214 | </listitem>
|
---|
| 215 | </varlistentry>
|
---|
[673b0d8] | 216 |
|
---|
[b8a819f] | 217 | <varlistentry id="sulogin">
|
---|
| 218 | <term><command>sulogin</command></term>
|
---|
[c6cb3aa] | 219 | <listitem>
|
---|
[673b0d8] | 220 | <indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
|
---|
[c6cb3aa] | 221 | <para>allows the superuser to log in. It is
|
---|
[673b0d8] | 222 | normally invoked by init when the system goes into single user mode.</para>
|
---|
[c6cb3aa] | 223 | </listitem>
|
---|
| 224 | </varlistentry>
|
---|
[673b0d8] | 225 |
|
---|
[b8a819f] | 226 | <varlistentry id="telinit">
|
---|
| 227 | <term><command>telinit</command></term>
|
---|
[c6cb3aa] | 228 | <listitem>
|
---|
[673b0d8] | 229 | <indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
|
---|
[c6cb3aa] | 230 | <para>tells init which run-level to enter.</para>
|
---|
| 231 | </listitem>
|
---|
| 232 | </varlistentry>
|
---|
[673b0d8] | 233 |
|
---|
[b8a819f] | 234 | <varlistentry id="utmpdump">
|
---|
| 235 | <term><command>utmpdump</command></term>
|
---|
[c6cb3aa] | 236 | <listitem>
|
---|
[673b0d8] | 237 | <indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
|
---|
[c6cb3aa] | 238 | <para>displays the content of the given login file in a friendlier format.</para>
|
---|
| 239 | </listitem>
|
---|
| 240 | </varlistentry>
|
---|
[673b0d8] | 241 |
|
---|
[b8a819f] | 242 | <varlistentry id="wall">
|
---|
| 243 | <term><command>wall</command></term>
|
---|
[c6cb3aa] | 244 | <listitem>
|
---|
[673b0d8] | 245 | <indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
|
---|
[c6cb3aa] | 246 | <para>writes a message to all logged-in users.</para>
|
---|
| 247 | </listitem>
|
---|
| 248 | </varlistentry>
|
---|
| 249 | </variablelist>
|
---|
[673b0d8] | 250 |
|
---|
| 251 | </sect2>
|
---|
| 252 |
|
---|
| 253 | </sect1>
|
---|