sysvinit.xml 9.3 KB

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