[673b0d8] | 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 | ]>
|
---|
[3be4d97] | 6 | <sect1 id="ch-system-sysvinit" xreflabel="Sysvinit">
|
---|
[673b0d8] | 7 | <title>Sysvinit-&sysvinit-version;</title>
|
---|
| 8 | <?dbhtml filename="sysvinit.html"?>
|
---|
| 9 |
|
---|
| 10 | <indexterm zone="ch-system-sysvinit"><primary sortas="a-Sysvinit">Sysvinit</primary></indexterm>
|
---|
[6370fa6] | 11 |
|
---|
[5888299] | 12 | <para>The Sysvinit package contains programs for controlling the startup,
|
---|
| 13 | running, and shutdown of your system.</para>
|
---|
| 14 |
|
---|
[673b0d8] | 15 | <screen>&buildtime; 0.1 SBU
|
---|
| 16 | &diskspace; 0.9 MB</screen>
|
---|
| 17 |
|
---|
| 18 | <para>Sysvinit installation depends on: Binutils, Coreutils, GCC, Glibc, Make.</para>
|
---|
[3554fa3a] | 19 |
|
---|
[73aedd1d] | 20 |
|
---|
| 21 |
|
---|
| 22 | <sect2>
|
---|
| 23 | <title>Installation of Sysvinit</title>
|
---|
| 24 |
|
---|
[673b0d8] | 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>
|
---|
[73aedd1d] | 32 |
|
---|
| 33 | <screen><userinput>cp src/init.c{,.backup}
|
---|
[311e8a5] | 34 | sed 's/Sending processes/& started by init/g' \
|
---|
[673b0d8] | 35 | src/init.c.backup > src/init.c</userinput></screen>
|
---|
[73aedd1d] | 36 |
|
---|
| 37 | <para>Compile Sysvinit:</para>
|
---|
| 38 |
|
---|
| 39 | <screen><userinput>make -C src</userinput></screen>
|
---|
| 40 |
|
---|
[673b0d8] | 41 | <para>Then install it:</para>
|
---|
[73aedd1d] | 42 |
|
---|
| 43 | <screen><userinput>make -C src install</userinput></screen>
|
---|
| 44 |
|
---|
| 45 | </sect2>
|
---|
[5888299] | 46 |
|
---|
[342b176] | 47 |
|
---|
[673b0d8] | 48 | <sect2 id="conf-sysvinit"><title>Configuring Sysvinit</title>
|
---|
| 49 | <indexterm zone="conf-sysvinit">
|
---|
| 50 | <primary sortas="a-Sysvinit">Sysvinit</primary>
|
---|
| 51 | <secondary>configuring</secondary></indexterm>
|
---|
| 52 |
|
---|
| 53 | <indexterm zone="conf-sysvinit"><primary sortas="e-/etc/inittab">/etc/inittab</primary></indexterm>
|
---|
[342b176] | 54 |
|
---|
| 55 | <para>Create a new <filename>/etc/inittab</filename> file by running the
|
---|
| 56 | following:</para>
|
---|
| 57 |
|
---|
| 58 | <screen><userinput>cat > /etc/inittab << "EOF"</userinput>
|
---|
| 59 | # Begin /etc/inittab
|
---|
| 60 |
|
---|
| 61 | id:3:initdefault:
|
---|
| 62 |
|
---|
| 63 | si::sysinit:/etc/rc.d/init.d/rc sysinit
|
---|
| 64 |
|
---|
| 65 | l0:0:wait:/etc/rc.d/init.d/rc 0
|
---|
| 66 | l1:S1:wait:/etc/rc.d/init.d/rc 1
|
---|
| 67 | l2:2:wait:/etc/rc.d/init.d/rc 2
|
---|
| 68 | l3:3:wait:/etc/rc.d/init.d/rc 3
|
---|
| 69 | l4:4:wait:/etc/rc.d/init.d/rc 4
|
---|
| 70 | l5:5:wait:/etc/rc.d/init.d/rc 5
|
---|
| 71 | l6:6:wait:/etc/rc.d/init.d/rc 6
|
---|
| 72 |
|
---|
| 73 | ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
|
---|
| 74 |
|
---|
| 75 | su:S016:once:/sbin/sulogin
|
---|
| 76 |
|
---|
| 77 | 1:2345:respawn:/sbin/agetty tty1 9600
|
---|
| 78 | 2:2345:respawn:/sbin/agetty tty2 9600
|
---|
| 79 | 3:2345:respawn:/sbin/agetty tty3 9600
|
---|
| 80 | 4:2345:respawn:/sbin/agetty tty4 9600
|
---|
| 81 | 5:2345:respawn:/sbin/agetty tty5 9600
|
---|
| 82 | 6:2345:respawn:/sbin/agetty tty6 9600
|
---|
| 83 |
|
---|
| 84 | # End /etc/inittab
|
---|
| 85 | <userinput>EOF</userinput></screen>
|
---|
| 86 |
|
---|
| 87 | </sect2>
|
---|
[5888299] | 88 |
|
---|
| 89 |
|
---|
[673b0d8] | 90 | <sect2 id="contents-sysvinit"><title>Contents of Sysvinit</title>
|
---|
| 91 |
|
---|
| 92 | <para><emphasis>Installed programs</emphasis>: halt, init, killall5, last,
|
---|
| 93 | lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt),
|
---|
| 94 | reboot (link to halt), runlevel, shutdown, sulogin, telinit (link to init),
|
---|
| 95 | utmpdump and wall</para>
|
---|
| 96 |
|
---|
| 97 | </sect2>
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | <sect2><title>Short descriptions</title>
|
---|
| 101 |
|
---|
| 102 | <indexterm zone="ch-system-sysvinit halt"><primary sortas="b-halt">halt</primary></indexterm>
|
---|
| 103 | <para id="halt"><command>halt</command> normally invokes shutdown with the -h flag,
|
---|
| 104 | except when already in run-level 0, then it tells the kernel to halt the system.
|
---|
| 105 | But first it notes in the file <filename>/var/log/wtmp</filename> that the
|
---|
| 106 | system is being brought down.</para>
|
---|
| 107 |
|
---|
| 108 | <indexterm zone="ch-system-sysvinit init"><primary sortas="b-init">init</primary></indexterm>
|
---|
| 109 | <para id="init"><command>init</command> is the mother of all processes. It reads its
|
---|
| 110 | commands from <filename>/etc/inittab</filename>, which normally tell it which
|
---|
| 111 | scripts to run for which run-level, and how many gettys to spawn.</para>
|
---|
| 112 |
|
---|
| 113 | <indexterm zone="ch-system-sysvinit killall5"><primary sortas="b-killall5">killall5</primary></indexterm>
|
---|
| 114 | <para id="killall5"><command>killall5</command> sends a signal to all processes, except
|
---|
| 115 | the processes in its own session -- so it won't kill the shell running the
|
---|
| 116 | script that called it.</para>
|
---|
| 117 |
|
---|
| 118 | <indexterm zone="ch-system-sysvinit last"><primary sortas="b-last">last</primary></indexterm>
|
---|
| 119 | <para id="last"><command>last</command> shows which users last logged in (and out),
|
---|
| 120 | searching back through the file <filename>/var/log/wtmp</filename>. It can
|
---|
| 121 | also show system boots and shutdowns, and run-level changes.</para>
|
---|
| 122 |
|
---|
| 123 | <indexterm zone="ch-system-sysvinit lastb"><primary sortas="b-lastb">lastb</primary></indexterm>
|
---|
| 124 | <para id="lastb"><command>lastb</command> shows the failed login attempts, as logged
|
---|
| 125 | in <filename>/var/log/btmp</filename>.</para>
|
---|
| 126 |
|
---|
| 127 | <indexterm zone="ch-system-sysvinit mesg"><primary sortas="b-mesg">mesg</primary></indexterm>
|
---|
| 128 | <para id="mesg"><command>mesg</command> controls whether other users can send
|
---|
| 129 | messages to the current user's terminal.</para>
|
---|
[73aedd1d] | 130 |
|
---|
[673b0d8] | 131 | <indexterm zone="ch-system-sysvinit pidof"><primary sortas="b-pidof">pidof</primary></indexterm>
|
---|
| 132 | <para id="pidof"><command>pidof</command> reports the PIDs of the given programs.</para>
|
---|
| 133 |
|
---|
| 134 | <indexterm zone="ch-system-sysvinit poweroff"><primary sortas="b-poweroff">poweroff</primary></indexterm>
|
---|
| 135 | <para id="poweroff"><command>poweroff</command> tells the kernel to halt the system and
|
---|
| 136 | switch off the computer. But see halt.</para>
|
---|
| 137 |
|
---|
| 138 | <indexterm zone="ch-system-sysvinit reboot"><primary sortas="b-reboot">reboot</primary></indexterm>
|
---|
| 139 | <para id="reboot"><command>reboot</command> tells the kernel to reboot the system.
|
---|
| 140 | But see halt.</para>
|
---|
| 141 |
|
---|
| 142 | <indexterm zone="ch-system-sysvinit runlevel"><primary sortas="b-runlevel">runlevel</primary></indexterm>
|
---|
| 143 | <para id="runlevel"><command>runlevel</command> reports the previous and the current
|
---|
| 144 | run-level, as noted in the last run-level record in
|
---|
| 145 | <filename>/var/run/utmp</filename>.</para>
|
---|
| 146 |
|
---|
| 147 | <indexterm zone="ch-system-sysvinit shutdown"><primary sortas="b-shutdown">shutdown</primary></indexterm>
|
---|
| 148 | <para id="shutdown"><command>shutdown</command> brings the system down in a secure way,
|
---|
| 149 | signaling all processes and notifying all logged-in users.</para>
|
---|
| 150 |
|
---|
| 151 | <indexterm zone="ch-system-sysvinit sulogin"><primary sortas="b-sulogin">sulogin</primary></indexterm>
|
---|
| 152 | <para id="sulogin"><command>sulogin</command> allows the superuser to log in. It is
|
---|
| 153 | normally invoked by init when the system goes into single user mode.</para>
|
---|
| 154 |
|
---|
| 155 | <indexterm zone="ch-system-sysvinit telinit"><primary sortas="b-telinit">telinit</primary></indexterm>
|
---|
| 156 | <para id="telinit"><command>telinit</command> tells init which run-level to enter.</para>
|
---|
| 157 |
|
---|
| 158 | <indexterm zone="ch-system-sysvinit utmpdump"><primary sortas="b-utmpdump">utmpdump</primary></indexterm>
|
---|
| 159 | <para id="utmpdump"><command>utmpdump</command> displays the content of the given login
|
---|
| 160 | file in a friendlier format.</para>
|
---|
| 161 |
|
---|
| 162 | <indexterm zone="ch-system-sysvinit wall"><primary sortas="b-wall">wall</primary></indexterm>
|
---|
| 163 | <para id="wall"><command>wall</command> writes a message to all logged-in users.</para>
|
---|
| 164 |
|
---|
| 165 | </sect2>
|
---|
| 166 |
|
---|
| 167 |
|
---|
| 168 |
|
---|
| 169 | </sect1>
|
---|