2004-05-03 11:59:46 +01:00
<?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;
]>
2004-05-16 01:08:42 +01:00
<sect1 id= "ch-system-sysvinit" xreflabel= "Sysvinit" role= "wrap" >
2004-05-03 11:59:46 +01:00
<title > Sysvinit-&sysvinit-version; </title>
<?dbhtml filename="sysvinit.html"?>
<indexterm zone= "ch-system-sysvinit" > <primary sortas= "a-Sysvinit" > Sysvinit</primary> </indexterm>
2001-01-24 00:31:17 +00:00
2004-05-16 01:08:42 +01:00
<sect2 role= "package" > <title />
2004-01-12 23:23:50 +00:00
<para > The Sysvinit package contains programs for controlling the startup,
running, and shutdown of your system.</para>
2004-05-16 01:08:42 +01:00
<segmentedlist >
<segtitle > &buildtime; </segtitle>
<segtitle > &diskspace; </segtitle>
<seglistitem > <seg > 0.1 SBU</seg> <seg > 0.9 MB</seg> </seglistitem>
</segmentedlist>
2004-05-03 11:59:46 +01:00
2004-05-16 01:08:42 +01:00
<segmentedlist >
<segtitle > Sysvinit installation depends on</segtitle>
<seglistitem > <seg > Binutils, Coreutils, GCC, Glibc, Make</seg> </seglistitem>
</segmentedlist>
</sect2>
2001-07-17 19:51:18 +01:00
2004-05-16 01:08:42 +01:00
<sect2 role= "installation" >
2003-11-01 22:31:50 +00:00
<title > Installation of Sysvinit</title>
2004-05-03 11:59:46 +01:00
<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 new
run-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 this
misinterpretation, you can modify the source so that these messages read like
<quote > Sending processes started by init the TERM signal</quote> instead:</para>
2003-11-01 22:31:50 +00:00
2004-06-07 20:16:21 +01:00
<screen > <userinput > sed -i 's@Sending processes@& started by init@g' \
src/init.c</userinput> </screen>
2003-11-01 22:31:50 +00:00
<para > Compile Sysvinit:</para>
<screen > <userinput > make -C src</userinput> </screen>
2004-05-03 11:59:46 +01:00
<para > Then install it:</para>
2003-11-01 22:31:50 +00:00
<screen > <userinput > make -C src install</userinput> </screen>
</sect2>
2004-01-12 23:23:50 +00:00
2004-02-09 22:45:54 +00:00
2004-05-18 21:38:03 +01:00
<sect2 id= "conf-sysvinit" role= "configuration" > <title > Configuring Sysvinit</title>
2004-05-03 11:59:46 +01:00
<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>
2004-02-09 22:45:54 +00:00
<para > Create a new <filename > /etc/inittab</filename> file by running the
following:</para>
2004-06-19 14:39:28 +01:00
<screen > <userinput > cat > /etc/inittab < < "EOF"
2004-02-09 22:45:54 +00:00
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
2004-05-06 17:22:04 +01:00
1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
2004-02-09 22:45:54 +00:00
# End /etc/inittab
2004-06-19 14:39:28 +01:00
EOF</userinput> </screen>
2004-02-09 22:45:54 +00:00
2004-06-19 14:39:28 +01:00
<para > The <parameter > -I '\033(K'</parameter> switch tells <command > agetty</command> to send this escape sequence to
2004-05-06 17:22:04 +01:00
the terminal before doing anything else. This escape sequence switches the
console character set to a user-defined one, which can be modified by
running the <command > setfont</command> program.
Actually, the <command > console</command> initscript from the LFS-Bootscripts
package calls the <command > setfont</command> program during system
startup. Sending this escape sequence is necessary for
people who use non-ISO-8859-1 screen font, but does not hurt native English
speakers.</para>
2004-02-09 22:45:54 +00:00
</sect2>
2004-01-12 23:23:50 +00:00
2004-05-17 22:55:01 +01:00
<sect2 id= "contents-sysvinit" role= "content" > <title > Contents of Sysvinit</title>
2004-05-03 11:59:46 +01:00
2004-05-17 22:55:01 +01:00
<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>
2004-05-03 11:59:46 +01:00
2004-05-17 22:55:01 +01:00
<variablelist > <title > Short descriptions</title>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "halt" >
<term > <command > halt</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit halt" > <primary sortas= "b-halt" > halt</primary> </indexterm>
2004-06-19 14:39:28 +01:00
<para > normally invokes <command > shutdown</command> with the <parameter > -h</parameter> flag,
2004-05-03 11:59:46 +01:00
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 the
system is being brought down.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "init" >
<term > <command > init</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit init" > <primary sortas= "b-init" > init</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > is the mother of all processes. It reads its
2004-05-03 11:59:46 +01:00
commands from <filename > /etc/inittab</filename> , which normally tell it which
scripts to run for which run-level, and how many gettys to spawn.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "killall5" >
<term > <command > killall5</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit killall5" > <primary sortas= "b-killall5" > killall5</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<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>
2004-05-24 22:37:26 +01:00
<varlistentry id= "last" >
<term > <command > last</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit last" > <primary sortas= "b-last" > last</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > shows which users last logged in (and out),
2004-05-03 11:59:46 +01:00
searching back through the file <filename > /var/log/wtmp</filename> . It can
also show system boots and shutdowns, and run-level changes.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "lastb" >
<term > <command > lastb</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit lastb" > <primary sortas= "b-lastb" > lastb</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > shows the failed login attempts, as logged in
<filename > /var/log/btmp</filename> .</para>
</listitem>
</varlistentry>
2004-05-24 22:37:26 +01:00
<varlistentry id= "mesg" >
<term > <command > mesg</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit mesg" > <primary sortas= "b-mesg" > mesg</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > controls whether other users can send
2004-05-03 11:59:46 +01:00
messages to the current user's terminal.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2003-11-01 22:31:50 +00:00
2004-12-17 20:53:49 +00:00
<varlistentry id= "mountpoint" >
<term > <command > mountpoint</command> </term>
<listitem >
<indexterm zone= "ch-system-sysvinit mountpoint" > <primary sortas= "b-mountpoint" > mountpoint</primary> </indexterm>
<para > checks if the directory is a mountpoint.</para>
</listitem>
</varlistentry>
2004-05-24 22:37:26 +01:00
<varlistentry id= "pidof" >
<term > <command > pidof</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit pidof" > <primary sortas= "b-pidof" > pidof</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > reports the PIDs of the given programs.</para>
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "poweroff" >
<term > <command > poweroff</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit poweroff" > <primary sortas= "b-poweroff" > poweroff</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > tells the kernel to halt the system and
2004-06-19 14:39:28 +01:00
switch off the computer. But see <command > halt</command> .</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "reboot" >
<term > <command > reboot</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit reboot" > <primary sortas= "b-reboot" > reboot</primary> </indexterm>
2004-06-19 14:39:28 +01:00
<para > tells the kernel to reboot the system. But see <command > halt</command> .</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "runlevel" >
<term > <command > runlevel</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit runlevel" > <primary sortas= "b-runlevel" > runlevel</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<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>
2004-05-24 22:37:26 +01:00
<varlistentry id= "shutdown" >
<term > <command > shutdown</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit shutdown" > <primary sortas= "b-shutdown" > shutdown</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > brings the system down in a secure way,
2004-05-03 11:59:46 +01:00
signaling all processes and notifying all logged-in users.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "sulogin" >
<term > <command > sulogin</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit sulogin" > <primary sortas= "b-sulogin" > sulogin</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > allows the superuser to log in. It is
2004-06-19 14:39:28 +01:00
normally invoked by <command > init</command> when the system goes into single user mode.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "telinit" >
<term > <command > telinit</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit telinit" > <primary sortas= "b-telinit" > telinit</primary> </indexterm>
2004-06-19 14:39:28 +01:00
<para > tells <command > init</command> which run-level to enter.</para>
2004-05-17 22:55:01 +01:00
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "utmpdump" >
<term > <command > utmpdump</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit utmpdump" > <primary sortas= "b-utmpdump" > utmpdump</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > displays the content of the given login file in a friendlier format.</para>
</listitem>
</varlistentry>
2004-05-03 11:59:46 +01:00
2004-05-24 22:37:26 +01:00
<varlistentry id= "wall" >
<term > <command > wall</command> </term>
2004-05-17 22:55:01 +01:00
<listitem >
2004-05-03 11:59:46 +01:00
<indexterm zone= "ch-system-sysvinit wall" > <primary sortas= "b-wall" > wall</primary> </indexterm>
2004-05-17 22:55:01 +01:00
<para > writes a message to all logged-in users.</para>
</listitem>
</varlistentry>
</variablelist>
2004-05-03 11:59:46 +01:00
</sect2>
</sect1>