| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | <sect1 id="ch-system-sysvinit" role="wrap">
 | 
|---|
| 8 |   <?dbhtml filename="sysvinit.html"?>
 | 
|---|
| 9 | 
 | 
|---|
| 10 |   <title>Sysvinit-&sysvinit-version;</title>
 | 
|---|
| 11 | 
 | 
|---|
| 12 |   <indexterm zone="ch-system-sysvinit">
 | 
|---|
| 13 |     <primary sortas="a-Sysvinit">Sysvinit</primary>
 | 
|---|
| 14 |   </indexterm>
 | 
|---|
| 15 | 
 | 
|---|
| 16 |   <sect2 role="package">
 | 
|---|
| 17 |     <title/>
 | 
|---|
| 18 | 
 | 
|---|
| 19 |     <para>The Sysvinit package contains programs for controlling the startup,
 | 
|---|
| 20 |     running, and shutdown of the system.</para>
 | 
|---|
| 21 | 
 | 
|---|
| 22 |   </sect2>
 | 
|---|
| 23 | 
 | 
|---|
| 24 |   <sect2 role="installation">
 | 
|---|
| 25 |     <title>Installation of Sysvinit</title>
 | 
|---|
| 26 | 
 | 
|---|
| 27 |     <para os="a">When run-levels are changed (for example, when halting the
 | 
|---|
| 28 |     system), <command>init</command> sends termination signals to those
 | 
|---|
| 29 |     processes that <command>init</command> itself started and that should
 | 
|---|
| 30 |     not be running in the new run-level.  While doing this,
 | 
|---|
| 31 |     <command>init</command> outputs messages like <quote>Sending processes
 | 
|---|
| 32 |     the TERM signal</quote> which seem to imply that it is sending these
 | 
|---|
| 33 |     signals to all currently running processes. To avoid this
 | 
|---|
| 34 |     misinterpretation, modify the source so that these messages read like
 | 
|---|
| 35 |     <quote>Sending processes started by init the TERM signal</quote>
 | 
|---|
| 36 |     instead:</para>
 | 
|---|
| 37 | 
 | 
|---|
| 38 | <screen os="b"><userinput>sed -i 's@Sending processes@& started by init@g' \
 | 
|---|
| 39 |     src/init.c</userinput></screen>
 | 
|---|
| 40 | 
 | 
|---|
| 41 |     <para os="c">Compile the package:</para>
 | 
|---|
| 42 | 
 | 
|---|
| 43 | <screen os="d"><userinput>make -C src clobber
 | 
|---|
| 44 | make -C src</userinput></screen>
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     <para os="e">Install the package:</para>
 | 
|---|
| 47 | 
 | 
|---|
| 48 | <screen os="f"><userinput>make -C src install</userinput></screen>
 | 
|---|
| 49 | 
 | 
|---|
| 50 |   </sect2>
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   <sect2 id="conf-sysvinit" role="configuration">
 | 
|---|
| 53 |     <title>Configuring Sysvinit</title>
 | 
|---|
| 54 | 
 | 
|---|
| 55 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 56 |       <primary sortas="a-Sysvinit">Sysvinit</primary>
 | 
|---|
| 57 |     <secondary>configuring</secondary></indexterm>
 | 
|---|
| 58 | 
 | 
|---|
| 59 |     <indexterm zone="conf-sysvinit">
 | 
|---|
| 60 |       <primary sortas="e-/etc/inittab">/etc/inittab</primary>
 | 
|---|
| 61 |     </indexterm>
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     <para>Create a new file <filename>/etc/inittab</filename> by running the
 | 
|---|
| 64 |     following:</para>
 | 
|---|
| 65 | 
 | 
|---|
| 66 | <screen><userinput>cat > /etc/inittab << "EOF"
 | 
|---|
| 67 | <literal># Begin /etc/inittab
 | 
|---|
| 68 | 
 | 
|---|
| 69 | id:3:initdefault:
 | 
|---|
| 70 | 
 | 
|---|
| 71 | si::sysinit:/etc/rc.d/init.d/rc sysinit
 | 
|---|
| 72 | 
 | 
|---|
| 73 | l0:0:wait:/etc/rc.d/init.d/rc 0
 | 
|---|
| 74 | l1:S1:wait:/etc/rc.d/init.d/rc 1
 | 
|---|
| 75 | l2:2:wait:/etc/rc.d/init.d/rc 2
 | 
|---|
| 76 | l3:3:wait:/etc/rc.d/init.d/rc 3
 | 
|---|
| 77 | l4:4:wait:/etc/rc.d/init.d/rc 4
 | 
|---|
| 78 | l5:5:wait:/etc/rc.d/init.d/rc 5
 | 
|---|
| 79 | l6:6:wait:/etc/rc.d/init.d/rc 6
 | 
|---|
| 80 | 
 | 
|---|
| 81 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 | 
|---|
| 82 | 
 | 
|---|
| 83 | su:S016:once:/sbin/sulogin
 | 
|---|
| 84 | 
 | 
|---|
| 85 | 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
 | 
|---|
| 86 | 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
 | 
|---|
| 87 | 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
 | 
|---|
| 88 | 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
 | 
|---|
| 89 | 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
 | 
|---|
| 90 | 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
 | 
|---|
| 91 | 
 | 
|---|
| 92 | # End /etc/inittab</literal>
 | 
|---|
| 93 | EOF</userinput></screen>
 | 
|---|
| 94 | 
 | 
|---|
| 95 |     <para>The <parameter>-I '\033(K'</parameter> option tells
 | 
|---|
| 96 |     <command>agetty</command> to send this escape sequence to the terminal
 | 
|---|
| 97 |     before doing anything else. This escape sequence switches the console
 | 
|---|
| 98 |     character set to a user-defined one, which can be modified by running
 | 
|---|
| 99 |     the <command>setfont</command> program. The <command>console</command>
 | 
|---|
| 100 |     initscript from the LFS-Bootscripts package calls the
 | 
|---|
| 101 |     <command>setfont</command> program during system startup. Sending this
 | 
|---|
| 102 |     escape sequence is necessary for people who use non-ISO 8859-1 screen
 | 
|---|
| 103 |     fonts, but it does not affect native English speakers.</para>
 | 
|---|
| 104 | 
 | 
|---|
| 105 |   </sect2>
 | 
|---|
| 106 | 
 | 
|---|
| 107 |   <sect2 id="contents-sysvinit" role="content">
 | 
|---|
| 108 |     <title>Contents of Sysvinit</title>
 | 
|---|
| 109 | 
 | 
|---|
| 110 |     <segmentedlist>
 | 
|---|
| 111 |       <segtitle>Installed programs</segtitle>
 | 
|---|
| 112 | 
 | 
|---|
| 113 |       <seglistitem>
 | 
|---|
| 114 |         <seg>halt, init, killall5, last, lastb (link to last), mesg, mountpoint, pidof
 | 
|---|
| 115 |         (link to killall5), poweroff (link to halt), reboot (link to halt),
 | 
|---|
| 116 |         runlevel, shutdown, sulogin, telinit (link to init), utmpdump,
 | 
|---|
| 117 |         and wall</seg>
 | 
|---|
| 118 |       </seglistitem>
 | 
|---|
| 119 |     </segmentedlist>
 | 
|---|
| 120 | 
 | 
|---|
| 121 |     <variablelist>
 | 
|---|
| 122 |       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
 | 
|---|
| 123 |       <?dbfo list-presentation="list"?>
 | 
|---|
| 124 |       <?dbhtml list-presentation="table"?>
 | 
|---|
| 125 | 
 | 
|---|
| 126 |       <varlistentry id="halt">
 | 
|---|
| 127 |         <term><command>halt</command></term>
 | 
|---|
| 128 |         <listitem>
 | 
|---|
| 129 |           <para>Normally invokes <command>shutdown</command> with the
 | 
|---|
| 130 |           <parameter>-h</parameter> option, except when already in run-level 0,
 | 
|---|
| 131 |           then it tells the kernel to halt the system; it notes in the
 | 
|---|
| 132 |           file <filename>/var/log/wtmp</filename> that the system is being
 | 
|---|
| 133 |           brought down</para>
 | 
|---|
| 134 |           <indexterm zone="ch-system-sysvinit halt">
 | 
|---|
| 135 |             <primary sortas="b-halt">halt</primary>
 | 
|---|
| 136 |           </indexterm>
 | 
|---|
| 137 |         </listitem>
 | 
|---|
| 138 |       </varlistentry>
 | 
|---|
| 139 | 
 | 
|---|
| 140 |       <varlistentry id="init">
 | 
|---|
| 141 |         <term><command>init</command></term>
 | 
|---|
| 142 |         <listitem>
 | 
|---|
| 143 |           <para>The first process to be started when the kernel has initialized
 | 
|---|
| 144 |           the hardware which takes over the boot process and starts all the
 | 
|---|
| 145 |           proceses it is instructed to</para>
 | 
|---|
| 146 |           <indexterm zone="ch-system-sysvinit init">
 | 
|---|
| 147 |             <primary sortas="b-init">init</primary>
 | 
|---|
| 148 |           </indexterm>
 | 
|---|
| 149 |         </listitem>
 | 
|---|
| 150 |       </varlistentry>
 | 
|---|
| 151 | 
 | 
|---|
| 152 |       <varlistentry id="killall5">
 | 
|---|
| 153 |         <term><command>killall5</command></term>
 | 
|---|
| 154 |         <listitem>
 | 
|---|
| 155 |           <para>Sends a signal to all processes, except the processes in its own
 | 
|---|
| 156 |           session so it will not kill the shell running the script that called
 | 
|---|
| 157 |           it</para>
 | 
|---|
| 158 |           <indexterm zone="ch-system-sysvinit killall5">
 | 
|---|
| 159 |             <primary sortas="b-killall5">killall5</primary>
 | 
|---|
| 160 |           </indexterm>
 | 
|---|
| 161 |         </listitem>
 | 
|---|
| 162 |       </varlistentry>
 | 
|---|
| 163 | 
 | 
|---|
| 164 |       <varlistentry id="last">
 | 
|---|
| 165 |         <term><command>last</command></term>
 | 
|---|
| 166 |         <listitem>
 | 
|---|
| 167 |           <para>Shows which users last logged in (and out), searching back
 | 
|---|
| 168 |           through the <filename>/var/log/wtmp</filename> file; it also shows
 | 
|---|
| 169 |           system boots, shutdowns, and run-level changes</para>
 | 
|---|
| 170 |           <indexterm zone="ch-system-sysvinit last">
 | 
|---|
| 171 |             <primary sortas="b-last">last</primary>
 | 
|---|
| 172 |           </indexterm>
 | 
|---|
| 173 |         </listitem>
 | 
|---|
| 174 |       </varlistentry>
 | 
|---|
| 175 | 
 | 
|---|
| 176 |       <varlistentry id="lastb">
 | 
|---|
| 177 |         <term><command>lastb</command></term>
 | 
|---|
| 178 |         <listitem>
 | 
|---|
| 179 |           <para>Shows the failed login attempts, as logged in
 | 
|---|
| 180 |           <filename>/var/log/btmp</filename></para>
 | 
|---|
| 181 |           <indexterm zone="ch-system-sysvinit lastb">
 | 
|---|
| 182 |             <primary sortas="b-lastb">lastb</primary>
 | 
|---|
| 183 |           </indexterm>
 | 
|---|
| 184 |         </listitem>
 | 
|---|
| 185 |       </varlistentry>
 | 
|---|
| 186 | 
 | 
|---|
| 187 |       <varlistentry id="mesg">
 | 
|---|
| 188 |         <term><command>mesg</command></term>
 | 
|---|
| 189 |         <listitem>
 | 
|---|
| 190 |           <para>Controls whether other users can send messages to the current
 | 
|---|
| 191 |           user's terminal</para>
 | 
|---|
| 192 |           <indexterm zone="ch-system-sysvinit mesg">
 | 
|---|
| 193 |             <primary sortas="b-mesg">mesg</primary>
 | 
|---|
| 194 |           </indexterm>
 | 
|---|
| 195 |         </listitem>
 | 
|---|
| 196 |       </varlistentry>
 | 
|---|
| 197 | 
 | 
|---|
| 198 |       <varlistentry id="mountpoint">
 | 
|---|
| 199 |         <term><command>mountpoint</command></term>
 | 
|---|
| 200 |         <listitem>
 | 
|---|
| 201 |           <para>Tells you whether or not a directory is a mount point.</para>
 | 
|---|
| 202 |           <indexterm zone="ch-system-sysvinit mountpoint">
 | 
|---|
| 203 |             <primary sortas="b-mountpoint">mountpoint</primary>
 | 
|---|
| 204 |           </indexterm>
 | 
|---|
| 205 |         </listitem>
 | 
|---|
| 206 |       </varlistentry>
 | 
|---|
| 207 | 
 | 
|---|
| 208 |       <varlistentry id="pidof">
 | 
|---|
| 209 |         <term><command>pidof</command></term>
 | 
|---|
| 210 |         <listitem>
 | 
|---|
| 211 |           <para>Reports the PIDs of the given programs</para>
 | 
|---|
| 212 |           <indexterm zone="ch-system-sysvinit pidof">
 | 
|---|
| 213 |             <primary sortas="b-pidof">pidof</primary>
 | 
|---|
| 214 |           </indexterm>
 | 
|---|
| 215 |         </listitem>
 | 
|---|
| 216 |       </varlistentry>
 | 
|---|
| 217 | 
 | 
|---|
| 218 |       <varlistentry id="poweroff">
 | 
|---|
| 219 |         <term><command>poweroff</command></term>
 | 
|---|
| 220 |         <listitem>
 | 
|---|
| 221 |           <para>Tells the kernel to halt the system and switch off the computer
 | 
|---|
| 222 |           (see <command>halt</command>)</para>
 | 
|---|
| 223 |           <indexterm zone="ch-system-sysvinit poweroff">
 | 
|---|
| 224 |             <primary sortas="b-poweroff">poweroff</primary>
 | 
|---|
| 225 |           </indexterm>
 | 
|---|
| 226 |         </listitem>
 | 
|---|
| 227 |       </varlistentry>
 | 
|---|
| 228 | 
 | 
|---|
| 229 |       <varlistentry id="reboot">
 | 
|---|
| 230 |         <term><command>reboot</command></term>
 | 
|---|
| 231 |         <listitem>
 | 
|---|
| 232 |           <para>Tells the kernel to reboot the system (see
 | 
|---|
| 233 |           <command>halt</command>)</para>
 | 
|---|
| 234 |           <indexterm zone="ch-system-sysvinit reboot">
 | 
|---|
| 235 |             <primary sortas="b-reboot">reboot</primary>
 | 
|---|
| 236 |           </indexterm>
 | 
|---|
| 237 |         </listitem>
 | 
|---|
| 238 |       </varlistentry>
 | 
|---|
| 239 | 
 | 
|---|
| 240 |       <varlistentry id="runlevel">
 | 
|---|
| 241 |         <term><command>runlevel</command></term>
 | 
|---|
| 242 |         <listitem>
 | 
|---|
| 243 |           <para>Reports the previous and the current run-level, as noted in
 | 
|---|
| 244 |           the last run-level record in <filename>/var/run/utmp</filename></para>
 | 
|---|
| 245 |           <indexterm zone="ch-system-sysvinit runlevel">
 | 
|---|
| 246 |             <primary sortas="b-runlevel">runlevel</primary>
 | 
|---|
| 247 |           </indexterm>
 | 
|---|
| 248 |         </listitem>
 | 
|---|
| 249 |       </varlistentry>
 | 
|---|
| 250 | 
 | 
|---|
| 251 |       <varlistentry id="shutdown">
 | 
|---|
| 252 |         <term><command>shutdown</command></term>
 | 
|---|
| 253 |         <listitem>
 | 
|---|
| 254 |           <para>Brings the system down in a secure way, signaling all processes
 | 
|---|
| 255 |           and notifying all logged-in users</para>
 | 
|---|
| 256 |           <indexterm zone="ch-system-sysvinit shutdown">
 | 
|---|
| 257 |             <primary sortas="b-shutdown">shutdown</primary>
 | 
|---|
| 258 |           </indexterm>
 | 
|---|
| 259 |         </listitem>
 | 
|---|
| 260 |       </varlistentry>
 | 
|---|
| 261 | 
 | 
|---|
| 262 |       <varlistentry id="sulogin">
 | 
|---|
| 263 |         <term><command>sulogin</command></term>
 | 
|---|
| 264 |         <listitem>
 | 
|---|
| 265 |           <para>Allows <emphasis>root</emphasis> to log in; it is normally
 | 
|---|
| 266 |           invoked by <command>init</command> when the system goes into single
 | 
|---|
| 267 |           user mode</para>
 | 
|---|
| 268 |           <indexterm zone="ch-system-sysvinit sulogin">
 | 
|---|
| 269 |             <primary sortas="b-sulogin">sulogin</primary>
 | 
|---|
| 270 |           </indexterm>
 | 
|---|
| 271 |         </listitem>
 | 
|---|
| 272 |       </varlistentry>
 | 
|---|
| 273 | 
 | 
|---|
| 274 |       <varlistentry id="telinit">
 | 
|---|
| 275 |         <term><command>telinit</command></term>
 | 
|---|
| 276 |         <listitem>
 | 
|---|
| 277 |           <para>Tells <command>init</command> which run-level to change to</para>
 | 
|---|
| 278 |           <indexterm zone="ch-system-sysvinit telinit">
 | 
|---|
| 279 |             <primary sortas="b-telinit">telinit</primary>
 | 
|---|
| 280 |           </indexterm>
 | 
|---|
| 281 |         </listitem>
 | 
|---|
| 282 |       </varlistentry>
 | 
|---|
| 283 | 
 | 
|---|
| 284 |       <varlistentry id="utmpdump">
 | 
|---|
| 285 |         <term><command>utmpdump</command></term>
 | 
|---|
| 286 |         <listitem>
 | 
|---|
| 287 |           <para>Displays the content of the given login file in a more
 | 
|---|
| 288 |           user-friendly format</para>
 | 
|---|
| 289 |           <indexterm zone="ch-system-sysvinit utmpdump">
 | 
|---|
| 290 |             <primary sortas="b-utmpdump">utmpdump</primary>
 | 
|---|
| 291 |           </indexterm>
 | 
|---|
| 292 |         </listitem>
 | 
|---|
| 293 |       </varlistentry>
 | 
|---|
| 294 | 
 | 
|---|
| 295 |       <varlistentry id="wall">
 | 
|---|
| 296 |         <term><command>wall</command></term>
 | 
|---|
| 297 |         <listitem>
 | 
|---|
| 298 |           <para>Writes a message to all logged-in users</para>
 | 
|---|
| 299 |           <indexterm zone="ch-system-sysvinit wall">
 | 
|---|
| 300 |             <primary sortas="b-wall">wall</primary>
 | 
|---|
| 301 |           </indexterm>
 | 
|---|
| 302 |         </listitem>
 | 
|---|
| 303 |       </varlistentry>
 | 
|---|
| 304 | 
 | 
|---|
| 305 |     </variablelist>
 | 
|---|
| 306 | 
 | 
|---|
| 307 |   </sect2>
 | 
|---|
| 308 | 
 | 
|---|
| 309 | </sect1>
 | 
|---|