sysvinit.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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"><title>Contents of Sysvinit</title>
  79. <para><emphasis>Installed programs</emphasis>: halt, init, killall5, last,
  80. lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt),
  81. reboot (link to halt), runlevel, shutdown, sulogin, telinit (link to init),
  82. utmpdump and wall</para>
  83. </sect2>
  84. <sect2><title>Short descriptions</title>
  85. <indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
  86. <para id="halt"><command>halt</command> normally invokes shutdown with the -h flag,
  87. except when already in run-level 0, then it tells the kernel to halt the system.
  88. But first it notes in the file <filename>/var/log/wtmp</filename> that the
  89. system is being brought down.</para>
  90. <indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
  91. <para id="init"><command>init</command> is the mother of all processes. It reads its
  92. commands from <filename>/etc/inittab</filename>, which normally tell it which
  93. scripts to run for which run-level, and how many gettys to spawn.</para>
  94. <indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
  95. <para id="killall5"><command>killall5</command> sends a signal to all processes, except
  96. the processes in its own session -- so it won't kill the shell running the
  97. script that called it.</para>
  98. <indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
  99. <para id="last"><command>last</command> shows which users last logged in (and out),
  100. searching back through the file <filename>/var/log/wtmp</filename>. It can
  101. also show system boots and shutdowns, and run-level changes.</para>
  102. <indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
  103. <para id="lastb"><command>lastb</command> shows the failed login attempts, as logged
  104. in <filename>/var/log/btmp</filename>.</para>
  105. <indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
  106. <para id="mesg"><command>mesg</command> controls whether other users can send
  107. messages to the current user's terminal.</para>
  108. <indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
  109. <para id="pidof"><command>pidof</command> reports the PIDs of the given programs.</para>
  110. <indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
  111. <para id="poweroff"><command>poweroff</command> tells the kernel to halt the system and
  112. switch off the computer. But see halt.</para>
  113. <indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
  114. <para id="reboot"><command>reboot</command> tells the kernel to reboot the system.
  115. But see halt.</para>
  116. <indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
  117. <para id="runlevel"><command>runlevel</command> reports the previous and the current
  118. run-level, as noted in the last run-level record in
  119. <filename>/var/run/utmp</filename>.</para>
  120. <indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
  121. <para id="shutdown"><command>shutdown</command> brings the system down in a secure way,
  122. signaling all processes and notifying all logged-in users.</para>
  123. <indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
  124. <para id="sulogin"><command>sulogin</command> allows the superuser to log in. It is
  125. normally invoked by init when the system goes into single user mode.</para>
  126. <indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
  127. <para id="telinit"><command>telinit</command> tells init which run-level to enter.</para>
  128. <indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
  129. <para id="utmpdump"><command>utmpdump</command> displays the content of the given login
  130. file in a friendlier format.</para>
  131. <indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
  132. <para id="wall"><command>wall</command> writes a message to all logged-in users.</para>
  133. </sect2>
  134. </sect1>