sysvinit.xml 8.9 KB

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