sysvinit.xml 9.3 KB

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