| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 | <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [  <!ENTITY % general-entities SYSTEM "../general.ent">  %general-entities;]><sect1 id="ch-system-sysvinit" xreflabel="Sysvinit" role="wrap"><title>Sysvinit-&sysvinit-version;</title><?dbhtml filename="sysvinit.html"?><indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm><sect2 role="package"><title/><para>The Sysvinit package contains programs for controlling the startup,running, and shutdown of your system.</para><segmentedlist><segtitle>&buildtime;</segtitle><segtitle>&diskspace;</segtitle><seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem></segmentedlist><segmentedlist><segtitle>Sysvinit installation depends on</segtitle><seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make</seg></seglistitem></segmentedlist></sect2><sect2 role="installation"><title>Installation of Sysvinit</title><para>When run-levels are changed (for example, when halting the system),<command>init</command> sends termination signals to those processes that<command>init</command> itself started and that shouldn't be running in the newrun-level. While doing this, <command>init</command> outputs messages like<quote>Sending processes the TERM signal</quote> which seem to imply that it is sending these signals to all currently running processes. To avoid thismisinterpretation, you can modify the source so that these messages read like<quote>Sending processes started by init the TERM signal</quote> instead:</para><screen><userinput>cp src/init.c{,.backup}sed 's/Sending processes/& started by init/g' \    src/init.c.backup > src/init.c</userinput></screen><para>Compile Sysvinit:</para><screen><userinput>make -C src</userinput></screen><para>Then install it:</para><screen><userinput>make -C src install</userinput></screen></sect2><sect2 id="conf-sysvinit" role="configuration"><title>Configuring Sysvinit</title><indexterm zone="conf-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary><secondary>configuring</secondary></indexterm><indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm><para>Create a new <filename>/etc/inittab</filename> file by running thefollowing:</para><screen><userinput>cat > /etc/inittab << "EOF"</userinput># Begin /etc/inittabid:3:initdefault:si::sysinit:/etc/rc.d/init.d/rc sysinitl0:0:wait:/etc/rc.d/init.d/rc 0l1:S1:wait:/etc/rc.d/init.d/rc 1l2:2:wait:/etc/rc.d/init.d/rc 2l3:3:wait:/etc/rc.d/init.d/rc 3l4:4:wait:/etc/rc.d/init.d/rc 4l5:5:wait:/etc/rc.d/init.d/rc 5l6:6:wait:/etc/rc.d/init.d/rc 6ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r nowsu:S016:once:/sbin/sulogin1:2345:respawn:/sbin/agetty -I '\033(K' tty1 96002:2345:respawn:/sbin/agetty -I '\033(K' tty2 96003:2345:respawn:/sbin/agetty -I '\033(K' tty3 96004:2345:respawn:/sbin/agetty -I '\033(K' tty4 96005:2345:respawn:/sbin/agetty -I '\033(K' tty5 96006:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600# End /etc/inittab<userinput>EOF</userinput></screen><para> The -I '\033(K' switch tells agetty to send this escape sequence tothe terminal before doing anything else. This escape sequence switches theconsole character set to a user-defined one, which can be modified byrunning the <command>setfont</command> program.Actually, the <command>console</command> initscript from the LFS-Bootscriptspackage calls the <command>setfont</command> program during systemstartup. Sending this escape sequence is necessary forpeople who use non-ISO-8859-1 screen font, but does not hurt native Englishspeakers.</para></sect2><sect2 id="contents-sysvinit" role="content"><title>Contents of Sysvinit</title><segmentedlist><segtitle>Installed programs</segtitle><seglistitem><seg>halt, init, killall5, last, lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit (link to init), utmpdump and wall</seg></seglistitem></segmentedlist><variablelist><title>Short descriptions</title><varlistentry><term id="halt"><command>halt</command></term><listitem><indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm><para>normally invokes shutdown with the -h flag,except when already in run-level 0, then it tells the kernel to halt the system.But first it notes in the file <filename>/var/log/wtmp</filename> that thesystem is being brought down.</para></listitem></varlistentry><varlistentry><term id="init"><command>init</command></term><listitem><indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm><para>is the mother of all processes. It reads itscommands from <filename>/etc/inittab</filename>, which normally tell it whichscripts to run for which run-level, and how many gettys to spawn.</para></listitem></varlistentry><varlistentry><term id="killall5"><command>killall5</command></term><listitem><indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm><para>sends a signal to all processes, except the processes in its own session -- so it won't kill the shell running the script that called it.</para></listitem></varlistentry><varlistentry><term id="last"><command>last</command></term><listitem><indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm><para>shows which users last logged in (and out),searching back through the file <filename>/var/log/wtmp</filename>. It canalso show system boots and shutdowns, and run-level changes.</para></listitem></varlistentry><varlistentry><term id="lastb"><command>lastb</command></term><listitem><indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm><para>shows the failed login attempts, as logged in <filename>/var/log/btmp</filename>.</para></listitem></varlistentry><varlistentry><term id="mesg"><command>mesg</command></term><listitem><indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm><para>controls whether other users can sendmessages to the current user's terminal.</para></listitem></varlistentry><varlistentry><term id="pidof"><command>pidof</command></term><listitem><indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm><para>reports the PIDs of the given programs.</para></listitem></varlistentry><varlistentry><term id="poweroff"><command>poweroff</command></term><listitem><indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm><para>tells the kernel to halt the system andswitch off the computer. But see halt.</para></listitem></varlistentry><varlistentry><term id="reboot"><command>reboot</command></term><listitem><indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm><para>tells the kernel to reboot the system. But see halt.</para></listitem></varlistentry><varlistentry><term id="runlevel"><command>runlevel</command></term><listitem><indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm><para>reports the previous and the current run-level, as noted in the last run-level record in <filename>/var/run/utmp</filename>.</para></listitem></varlistentry><varlistentry><term id="shutdown"><command>shutdown</command></term><listitem><indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm><para>brings the system down in a secure way,signaling all processes and notifying all logged-in users.</para></listitem></varlistentry><varlistentry><term id="sulogin"><command>sulogin</command></term><listitem><indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm><para>allows the superuser to log in. It isnormally invoked by init when the system goes into single user mode.</para></listitem></varlistentry><varlistentry><term id="telinit"><command>telinit</command></term><listitem><indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm><para>tells init which run-level to enter.</para></listitem></varlistentry><varlistentry><term id="utmpdump"><command>utmpdump</command></term><listitem><indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm><para>displays the content of the given login file in a friendlier format.</para></listitem></varlistentry><varlistentry><term id="wall"><command>wall</command></term><listitem><indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm><para>writes a message to all logged-in users.</para></listitem></varlistentry></variablelist></sect2></sect1>
 |